code: public static void initEscapeClosesDialogs() {
  		final AWTEventListener awtEventListener = new AWTEventListener() {
  			/** {@inheritDoc} */
  			@Override
  			public void eventDispatched(final AWTEvent event) {
  				if (event instanceof KeyEvent
  						&& ((KeyEvent) event).getKeyCode() == KeyEvent.VK_ESCAPE
  						&& event.getID() == KeyEvent.KEY_PRESSED) {
  					escapePressed();
  				}
  			}
  		};
  		Toolkit.getDefaultToolkit().addAWTEventListener(awtEventListener, AWTEvent.KEY_EVENT_MASK);
  	}
docs: Initialisation d'événements sur la touche Escape pour fermer les dialogues.