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

    // A containing frame for formatting Components.
class ComponentFrame extends JFrame {
    public ComponentFrame(String title){
        super(title);
        final int width = 300, height = 125;
        setSize(width,height);
        setBackground(Color.white);

        getContentPane().add(new QuitJPanel(),"South");
        addWindowListener(new WindowCloser());
        setVisible(true);
    }

    public void addComponent(JComponent c){
        getComponentPanel().add(c);
    }

    protected JPanel getComponentPanel(){
        return componentPanel;
    }

    // Storage for the components.
    private final JPanel componentPanel = new JPanel();
    {
        BoxLayout layout = new BoxLayout(componentPanel,BoxLayout.X_AXIS);
        componentPanel.setLayout(layout);
        componentPanel.setBackground(Color.white);
        // Components are displayed in the central area.
        getContentPane().add(componentPanel,"Center");
    }
}
