import javax.swing.*;

public class BoxLayoutDemo {

    public static void main(String[] args) {
        JFrame frame = new JFrame("BoxLayout Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
        
        panel.add(new JButton("One"));
        panel.add(new JButton("Two"));
        panel.add(Box.createVerticalStrut(20));
        panel.add(new JButton("Three"));
        panel.add(new JButton("Four"));
        panel.add(Box.createVerticalGlue());
        panel.add(new JButton("Five"));    

        frame.setContentPane(panel);
        frame.pack();
        frame.setVisible(true);
    }

}
