private static int getVisibleRowCount(@NotNull JTable table) {
    Rectangle visibleRect = table.getVisibleRect();
    return getTrailingRow(table, visibleRect) - getLeadingRow(table, visibleRect) + 1;
  }
private static int getVisibleRowCount(@NotNull JTable table)