void (@NotNull JTable table, int top, int bottom, int index) { int size = table.getModel().getRowCount(); if (bottom >= size) { bottom = size - 1; } Rectangle cellBounds = getCellBounds(table, top, bottom); table.scrollRectToVisible(cellBounds); table.getSelectionModel().setSelectionInterval(index, index); ensureIndexIsVisible(table, index, 0); }