Form fields height in Java – how to align correctly

When you create a GridLayout in Java Swing, you should define the main labels and the fields one after another. Then only you get the correct height of the fields. If you define all labels first and then all the fields later, the height of the rows and columns does not align correctly.