import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;

    // Illustrate the effect of BoxLayout compared with FlowLayout.
    // Place two pairs of buttons in panels managed by different
    // layout managers.
class SwingBoxFrame1 extends JFrame {
    public SwingBoxFrame1() {
        final int width = 375, height = 150;
        setSize(width,height);

        Container contents = getContentPane();

        // This panel will use the default FlowLayout.
        JPanel flowPanel = new JPanel();
        flowPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

        // This panel will use a horizontal BoxLayout.
        JPanel boxPanel = new JPanel();
        boxPanel.setLayout(new BoxLayout(boxPanel,BoxLayout.X_AXIS));
        boxPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

        // Add two buttons to each panel.
        flowPanel.add(new JButton("Flow 1"));
        flowPanel.add(new JButton("Flow 2"));
        boxPanel.add(new JButton("Box 1"));
        boxPanel.add(new JButton("Box 2"));

        // Place the two panels side-by-side within a central panel.
        JPanel centerPanel = new JPanel();
        final int rows = 1, cols = 2;
        centerPanel.setLayout(new GridLayout(rows,cols));
        centerPanel.add(flowPanel);
        centerPanel.add(boxPanel);

        contents.add(centerPanel,"Center");
        JPanel quitPanel = new QuitJPanel();
        contents.add(quitPanel,"South");

        flowPanel.setBackground(Color.white);
        boxPanel.setBackground(Color.white);
        centerPanel.setBackground(Color.white);
        quitPanel.setBackground(Color.white);
    }
}
