April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
BoxLayout
nEmpilha seus componentes em linha ou em coluna de acordo com opção selecionado.
n...//Container panel = aFrame.getContentPane()...
npanel.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
nJButton b = new JButton("Button 1");
nb.setAlignmentX(Component.CENTER_ALIGNMENT); panel.add(b);
nb = new JButton("Button 2");
nb.setAlignmentX(Component.CENTER_ALIGNMENT); panel.add(b);
nb = new JButton("Button 3");
nb.setAlignmentX(Component.CENTER_ALIGNMENT);
npanel.add(b);
nb = new JButton("Long-Named Button 4");
nb.setAlignmentX(Component.CENTER_ALIGNMENT);
npanel.add(b);
nb = new JButton("5");
nb.setAlignmentX(Component.CENTER_ALIGNMENT);
npanel.add(b);                        
n                                           BoxLayoutDemo