I have got a JLabel : label1 with an image.Then i add a GridLayout on the Label. Then i make a new label: label2 and i add it in the label1.Then i make a new label:label3 and when i add it goes down from the label2 and not near.Why this happens? Look and my pictures(especi ally the second)

first picture with only label1
Code:
import javax.swing.*;
import java.awt.*;
public class GridLayoutDemo1 extends JFrame
{
public static final int WIDTH = 468;
public static final int HEIGHT = 468;
public static void main(String[] args)
{
GridLayoutDemo1 gui1 = new GridLayoutDemo1();
gui1.setVisible(true);
}
public GridLayoutDemo1()
{
setSize(WIDTH, HEIGHT);
addWindowListener(new WindowDestroyer());
Container content = getContentPane();
ImageIcon icon1 = new ImageIcon("tes.jpg");
JLabel label1 = new JLabel(icon1);
content.add(label1);
label1.setLayout(new GridLayout(10, 10));
JLabel label2 = new JLabel("First");
label1.add(label2);
JLabel label3 = new JLabel("Second");
label1.add(label3);
}
}

first picture with only label1
Comment