not a 3x4 grid (with only one component in the third row (and two spaces)).
Then you should create a GridLayout using:
setLayout(new GridLayout(0,4));
It tells the layout that you don't know how many rows you have, but you want 4 columns. Thus, the columns will be filled before moving to the next row.
No need for empty components.
source share