boolean (KeyEvent event) { int keyCode = event.getKeyCode(); int id = event.getID(); if (keyCode == KeyEvent.VK_ENTER || event.getKeyChar() == '\n') { if (id == KeyEvent.KEY_PRESSED && (mySearchPanel.controller == null || !mySearchPanel.controller.handleEnter(event))) { String text = getText(); if (!text.isEmpty()) { if (mySearchPanel.controller != null) { mySearchPanel.controller.hidePopup(); } showSearchPanel(text); } } return true; } if ((keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_UP) && id == KeyEvent.KEY_PRESSED && mySearchPanel.controller != null && mySearchPanel.controller.handleUpDown(event)) { return true; } return super.preprocessEventForTextField(event); }