setSize(300, 300);
center();
// Add the menu bar.
JMenuBar mb = new JMenuBar();
JMenu file = new JMenu("File", true);
file.add(new FilePrintAction()).setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK));
file.add(new FilePageSetupAction()).setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_P,
Event.CTRL_MASK | Event.SHIFT_MASK));
file.addSeparator();
file.add(new FileQuitAction()).setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK));
mb.add(file);
setJMenuBar(mb);
// Add the contents of the window.
getContentPane().add(new PatchworkComponent());
// Exit the application when the window is closed.
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});