public void keyPressed(KeyEvent key) { switch (key.getKeyChar()) { case KeyEvent.VK_ESCAPE: System.exit(0); break; } }