public static void ensureSelectionExists(@NotNull JTable table) {
    if (table.getSelectedRow() != -1 || table.getRowCount() == 0) return;
    table.setRowSelectionInterval(0, 0);
  }
public static void ensureSelectionExists(@NotNull JTable table)