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); } }