boolean (KeyEvent event) { if (!myDelegatingNow) { KeyStroke stroke = KeyStroke.getKeyStrokeForEvent(event); String strokeString = stroke.toString(); if ("pressed ESCAPE".equals(strokeString) && getText().length() > 0) { setText(""); // reset filter on ESC return true; } if (getTextEditor().isFocusOwner()) { try { myDelegatingNow = true; int code = stroke.getKeyCode(); boolean treeNavigation = stroke.getModifiers() == 0 && (code == KeyEvent.VK_UP || code == KeyEvent.VK_DOWN); if (treeNavigation || !hasAction(stroke, getTextEditor().getInputMap())) { onTextKeyEvent(event); return true; } } finally { myDelegatingNow = false; } } } return false; }