193194195196197198199200201202203
window.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowevent) { animator.stop(); window.remove(canvas); window.dispose(); System.exit(0); } }); window.add(canvas);