private static final KeyAdapter closeKeyStrokes ( final java . awt . Window window ) { return new KeyAdapter ( ) { public void keyReleased ( KeyEvent e ) { final int kc = e . getKeyCode ( ) ; if ( kc == KeyEvent . VK_ESCAPE || kc == KeyEvent . VK_ENTER ) { window . dispose ( ) ; } } } ; }
Listens to key to close a |window| .