void (@NotNull JList<?> list, @Nullable JComponent focusParent) { if (focusParent != null && focusParent != list) { focusParent.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.isShiftDown()) { if (e.getKeyCode() == KeyEvent.VK_DOWN) { list.dispatchEvent(e); e.consume(); } if (e.getKeyCode() == KeyEvent.VK_UP) { list.dispatchEvent(e); e.consume(); } } } }); } }