Please run the code below. I would like that the second text field in the second row to be right after the first text field (in the second row).
I would also like to have the components in the top-left corner.
yeah, I can use one JPanel per row, but I would like to know what's wrong with the constraints. And I still need to position the elements in the top-left corner.
for the component that contains GBL1Panel, but these often fails to function correctly
GridBagConstraints.anchor is used only for the components inside your GBL1Panel
Edit: and in GridBagLayout column widths are defined as what is the widthest component in column (component.getPreferredSize().width). you can use GridBagConstraints.gridwidth if some component should cover one or more columns