void (@NotNull KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER && (e.getModifiers() & InputEvent.SHIFT_MASK) != 0) { myClosedByShiftEnter = true; close(true); } if (!myListScrollPane.isVisible()) { return; } final int keyCode; // Add support for user-defined 'caret up/down' shortcuts. KeyStroke stroke = KeyStroke.getKeyStrokeForEvent(e); if (upShortcuts.contains(stroke)) { keyCode = KeyEvent.VK_UP; } else if (downShortcuts.contains(stroke)) { keyCode = KeyEvent.VK_DOWN; } else { keyCode = e.getKeyCode(); } switch (keyCode) { case KeyEvent.VK_DOWN -> ScrollingUtil.moveDown(myList, e.getModifiersEx()); case KeyEvent.VK_UP -> ScrollingUtil.moveUp(myList, e.getModifiersEx()); case KeyEvent.VK_PAGE_UP -> ScrollingUtil.movePageUp(myList); case KeyEvent.VK_PAGE_DOWN -> ScrollingUtil.movePageDown(myList); case KeyEvent.VK_TAB -> close(true); case KeyEvent.VK_ENTER -> { if (myList.getSelectedValue() == EXTRA_ELEM) { myMaximumListSizeLimit += myListSizeIncreasing; rebuildList(new SelectIndex(myList.getSelectedIndex()), myRebuildDelay, ModalityState.current(), null); e.consume(); } } } }