@Override public boolean dispatchKeyEvent(KeyEvent e) { int code = e.getKeyCode(); int modifiers = e.getModifiers(); if (code == KeyEvent.VK_ESCAPE) { if (isShowingSheet()) { discardTopSheet(); return true; } } if (code == KeyEvent.VK_Q && modifiers == Platform.getPlatform().getCommandModifierMask()) { shutdown(); return true; } return false; }