Reputation: 45
I'm making a JFrame
that contains a lot of JButton
s and JTextfield
s 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:
Upvotes: 0
Views: 80
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