void (KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED) { int keyCode = e.getKeyCode(); if (keyCode != KeyEvent.VK_SHIFT && keyCode != KeyEvent.VK_ALT && keyCode != KeyEvent.VK_CONTROL && keyCode != KeyEvent.VK_ALT_GRAPH && keyCode != KeyEvent.VK_META) { setKeyStroke(KeyStroke.getKeyStroke(keyCode, e.getModifiers())); } } // Ensure TAB/Shift-TAB work as focus traversal keys, otherwise // there is no proper way to move the focus outside the text field. if (ScreenReader.isActive()) { setFocusTraversalKeysEnabled(true); try { KeyboardFocusManager.getCurrentKeyboardFocusManager().processKeyEvent(this, e); } finally { setFocusTraversalKeysEnabled(false); } } }