int (@NotNull JTable table, @NotNull Rectangle visibleRect) { int row = table.rowAtPoint(getLeadingPoint(table, visibleRect)); if (row >= 0) return row; // return the first row in the table // if there is no any row at the given point return 0 < table.getRowCount() ? 0 : -1; }