Basma Ali
Basma Ali

Reputation: 45

Building a JFrame that run in the same order in Java

I'm making a JFrame that contains a lot of JButtons and JTextfields which contain data from a database. In the design everything is okay, but when I run my program the JButton and the JTextfield change their places and I don't know why.

Here is a screen shot from the design window and the run window:

Screenshot of design window

Screenshot of runtime window

Upvotes: 0

Views: 80

Answers (1)

teemann
teemann

Reputation: 106

Seems like you have aligned the textfields to each other and the buttons too. But you should have aligned one button to one textfield. One way to do this would be to use a GridBagLayout instead of the FreeDesign option in NetBeans. To do this right-click onto your frame and select Set Layout>Grid Bag Layout. You can then right-click again and select Customize Layout... in order to place your components as you wish.

Upvotes: 1

Related Questions