void (@NotNull JComponent c, int index, int moveDirection, int size) { int visible = visibleRowCount(c); int top; int bottom; if (moveDirection == 0) { top = index - (visible - 1) / ROW_PADDING; bottom = top + visible - 1; } else if (moveDirection < 0) { top = index - ROW_PADDING; bottom = index; } else { top = index; bottom = index + ROW_PADDING; } if (top < 0) { top = 0; } if (bottom >= size) { bottom = size - 1; } _ensureRangeIsVisible(c, top, bottom); }