GridBagLayout
is honouring the preferred size of the components.
If you would like the components to have the same height, you can use the fill
property of GridBagConstraints
and set it to GridBagConstraints.HORIZONTAL
, which will tell GridBagLayout
to fill all the component within the given row so that they meet the height of the row (which should be the height of highest component in the row)
If you just wish to align the components (to the top), you should change the anchor
property to GridBagConstraints.NORTH
See How to use GridBagLayout for more details