super("DoodlePad");
Container content = getContentPane( );
content.setLayout(new BorderLayout( ));
final DrawPad drawPad = new DrawPad( );
content.add(drawPad, BorderLayout.CENTER);
JPanel p = new JPanel( );
JButton clearButton = new JButton("Clear");
clearButton.addActionListener(new ActionListener( ) {
public void actionPerformed(ActionEvent e) {
drawPad.clear( );
}
});
p.add(clearButton);
content.add(p, BorderLayout.SOUTH);
setSize(280, 300);
setLocation(100, 100);
addWindowListener(new WindowAdapter( ) {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
setVisible(true);