There are three kinds of actuaries: those who can count, and those who can't.
have a look at your FormPanel class, line 24. What do you noticë?
Next, have a careful look at what you specify as GridBagConstraints.gridx and gridy.
There are three kinds of actuaries: those who can count, and those who can't.
So, you do create a JPanel with a GridBagLayout. But is that the JPanel to which you are adding your components?
And indeed: your gridx and gridy need to be different for each component.
mitchell bat wrote:
Yes, because there is no other JPanel created in the application, unless i'm missing something or it doesn't make sense to you?
There are three kinds of actuaries: those who can count, and those who can't.
Are you sure there is only one panel involved? (hint: have a look at your FormPanel class definition)
There are three kinds of actuaries: those who can count, and those who can't.
Your FormPanel IS a JPanel. That is why in the constructor your add(component...) works. It simply adds these components to this instance of FormPanel.
But the default LayoutManager is a FlowLayout, and since you did not replace that Layout (with : setLayout(...)), you are still using this FlowLayout.
Do your text fields appear correctly? I think they will shrink almost to invisibility if you don't give them a HORIZONTAL fill.
mitchell bat wrote:So for this in the ToolBar class line 15 change it from to ?
There are three kinds of actuaries: those who can count, and those who can't.
Well, you could if you feel like it, but personally, I liked the three buttons, neatly side by side in the toolbar! So the FlowLayout seems good enough.
By the way: as far as I know, there is no GridBagLayout constructor that has a parameter.