JFrame frame = new JFrame("DoodlePad");
Container content = frame.getContentPane();
content.setLayout(new BorderLayout());
final DrawPad drawPad = new DrawPad( );
content.add(drawPad, BorderLayout.CENTER);
JPanel panel = new JPanel();
JButton clearButton = new JButton("Clear");
clearButton.addActionListener(new ActionListener( ) {
public void actionPerformed(ActionEvent e) {
drawPad.clear( );
}
});
panel.add(clearButton);
content.add(panel, BorderLayout.SOUTH);
frame.setSize(280, 300);
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setVisible(true);