- frame.addKeyListener(new KeyAdapter(){
- public void keyPressed(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- closeGraph();
- }
- }
- });
- frame.addWindowListener(new WindowAdapter(){
- public void windowClosed(WindowEvent e) {
- // System.err.println("CLOSED: " + DrawingWindow.instances);
- if (--DrawingWindow.instances == 0)
- System.exit(0);
- }
- });