@Override public void processKeyEvent(KeyEvent ke) { //override the default handling so that //the parent will never receive the escape key and //close a modal dialog if (ke.getKeyCode() == KeyEvent.VK_ESCAPE) { removeSearchField(); ke.consume(); // #44394 // bugfix #32909, reqest focus when search field is removed NbList.this.requestFocus(); } else { super.processKeyEvent(ke); } } };
public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_ESCAPE) { removeSearchField(); NbList.this.requestFocus(); } else if (keyCode == KeyEvent.VK_UP) { currentSelectionIndex--; displaySearchResult(); // Stop processing the event here. Otherwise it's dispatched // to the tree too (which scrolls) e.consume(); } else if (keyCode == KeyEvent.VK_DOWN) { currentSelectionIndex++; displaySearchResult(); // Stop processing the event here. Otherwise it's dispatched // to the tree too (which scrolls) e.consume(); } else if (keyCode == KeyEvent.VK_TAB) { if (maxPrefix != null) searchTextField.setText(maxPrefix); e.consume(); } else if (keyCode == KeyEvent.VK_ENTER) { removeSearchField(); NbList.this.requestFocus(); NbList.this.dispatchEvent(e); } }
public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_ESCAPE) { removeSearchField(); NbList.this.requestFocus(); } else if (keyCode == KeyEvent.VK_UP) { currentSelectionIndex--; displaySearchResult(); // Stop processing the event here. Otherwise it's dispatched // to the tree too (which scrolls) e.consume(); } else if (keyCode == KeyEvent.VK_DOWN) { currentSelectionIndex++; displaySearchResult(); // Stop processing the event here. Otherwise it's dispatched // to the tree too (which scrolls) e.consume(); } else if (keyCode == KeyEvent.VK_TAB) { if (maxPrefix != null) searchTextField.setText(maxPrefix); e.consume(); } else if (keyCode == KeyEvent.VK_ENTER) { removeSearchField(); NbList.this.requestFocus(); NbList.this.dispatchEvent(e); } }
@Override public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_ESCAPE) { removeSearchField(); NbList.this.requestFocus(); } else if (keyCode == KeyEvent.VK_UP) { currentSelectionIndex--; displaySearchResult(); // Stop processing the event here. Otherwise it's dispatched // to the tree too (which scrolls) e.consume(); } else if (keyCode == KeyEvent.VK_DOWN) { currentSelectionIndex++; displaySearchResult(); // Stop processing the event here. Otherwise it's dispatched // to the tree too (which scrolls) e.consume(); } else if (keyCode == KeyEvent.VK_TAB) { if (maxPrefix != null) { searchTextField.setText(maxPrefix); } e.consume(); } else if (keyCode == KeyEvent.VK_ENTER) { removeSearchField(); NbList.this.requestFocus(); NbList.this.dispatchEvent(e); } }
/** * Removes the search field from the tree. */ private void removeSearchField() { if (searchpanel != null && searchpanel.isDisplayable()) { remove(searchpanel); ListView.this.getViewport().setScrollMode(originalScrollMode); this.repaint(searchpanel.getBounds()); requestFocus(); } }
/** * Removes the search field from the tree. */ private void removeSearchField() { if ((searchpanel != null) && searchpanel.isDisplayable()) { remove(searchpanel); ListView.this.getViewport().setScrollMode(originalScrollMode); this.repaint(searchpanel.getBounds()); requestFocus(); } }
/** * Removes the search field from the tree. */ private void removeSearchField() { if (searchpanel != null && searchpanel.isDisplayable()) { remove(searchpanel); ListView.this.getViewport().setScrollMode(originalScrollMode); this.repaint(searchpanel.getBounds()); requestFocus(); } }