void (@NotNull JComponent c, @NotNull ListSelectionModel selectionModel, @JdkConstants.InputEventMask final int modifiers, int size, boolean cycleScrolling, int direction) { if (size == 0) return; int index = selectionModel.getLeadSelectionIndex(); int indexToSelect = index + direction; if (indexToSelect < 0 || indexToSelect >= size) { if (cycleScrolling) { indexToSelect = indexToSelect < 0 ? size - 1 : 0; } else { return; } } _ensureIndexIsVisible(c, indexToSelect, direction, size); selectOrAddSelection(selectionModel, indexToSelect, modifiers); }