KeyStroke (KeyEvent event) { if (event != null && !event.isConsumed()) { int id = event.getID(); if (id == KeyEvent.KEY_TYPED) { return getKeyStroke(event.getKeyChar(), 0); } boolean released = id == KeyEvent.KEY_RELEASED; if (released || id == KeyEvent.KEY_PRESSED) { int code = event.getKeyCode(); if (code == KeyEvent.VK_UNDEFINED) { code = event.getExtendedKeyCode(); } return getKeyStroke(code, event.getModifiers(), released); } } return null; }