1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| public TestLayout(){
//Split
JSplitPane split = new JSplitPane();
JPanel gauche = new JPanel();
JPanel droite = new JPanel();
//Dans gauche
JPanel s1 = new JPanel();
s1.setBackground(Color.BLACK);
JPanel s2 = new JPanel();
s2.setBackground(Color.BLUE);
JPanel s3 = new JPanel();
s3.setBackground(Color.CYAN);
s1.setPreferredSize(new Dimension(200,200));
s2.setPreferredSize(new Dimension(150,150));
gauche.setLayout(new BorderLayout());
gauche.add(s1, BorderLayout.NORTH);
gauche.add(s2, BorderLayout.WEST);
gauche.add(s3, BorderLayout.CENTER);
split.setRightComponent(droite);
split.setLeftComponent(gauche);
add(split);
setExtendedState(MAXIMIZED_BOTH);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setVisible(true);
}
public static void main(String[] args)
{
new TestLayout();
} |