7
BorderLayout
BorderLayout : les composants sont positionnés et dimensionnés
dans 5 zones :
"nord" et "sud" occupent toute la largeur
"ouest" et "est" occupent la hauteur qui reste
"centre" occupe la place restante
North
South
West East
Center
Frame f = new Frame("orderTest");
f.setLayout(new BorderLayout());
f.add(new Button("Nord"),BorderLayout.NORTH);
f.add(new Button("Sud"),BorderLayout.SOUTH);
f.add(new Button("Est"),BorderLayout.EAST);
f.add(new Button("Ouest"),BorderLayout.WEST);
f.add(new Button("Centre"),BorderLayout.CENTER);
8
BorderLayout et FlowLayout
Panel flow = new Panel(new FlowLayout());
flow.add(new Button("A"));
flow.add(new Button("B"));
flow.add(new Button("C"));
flow.add(new Button("D"));
flow.add(new Button("E"));
Panel border = new Panel(new BorderLayout());
border.add(flow, BorderLayout.NORTH);
border.add(new Button("Sud"),BorderLayout.SOUTH);
border.add(new Button("Est"),BorderLayout.EAST);
border.add(new Button("Ouest"),BorderLayout.WEST);
border.add(new Button("Centre"),BorderLayout.CENTER);
Frame f = new Frame("BorderTest2");
f.add(border);