I have following code:
public Frame() {
super();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridLayout(0, 3));
for (int i = 0; i < 30; i++) {
add(new JLabel("label"));
}
}
All this works perfectly fine, untill you start vertically resizing the frame.
For some reason it creates a gap above and under the labels that grows and shrinks again when enlarging the frame.
This is most notable by looking at the top-line of labels that keep going up and down when you pull the underside of the frame further down.
For clarifcation, these are the problem areas.
The two areas in red are also filled while i want them to be empty.
Any idea how to get rid of this empty space?
Thanks