void (final KeyEvent e) { final int selected = getSelected(); if (selected != -1) { if (e.getKeyCode() == KeyEvent.VK_UP) { up(selected, selected); e.consume(); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { down(selected, selected); e.consume(); } } }