JFrame f = new JFrame("ShapesDemo");
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
ShapesPanel shapesPanel = new ShapesPanel();
f.getContentPane().add(shapesPanel, BorderLayout.CENTER);
f.setSize(new Dimension(550, 200));
f.setVisible(true);