Java JTable Row Selection setTableSelectedRows(JTable table, int... selectedRows)

Here you can find the source of setTableSelectedRows(JTable table, int... selectedRows)

Description

set Table Selected Rows

License

Open Source License

Declaration

public static void setTableSelectedRows(JTable table, int... selectedRows) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import javax.swing.*;

public class Main {
    public static void setTableSelectedRows(JTable table, int... selectedRows) {
        if (selectedRows.length == 0) {
            table.clearSelection();/*  w ww . ja  v  a2s. co  m*/
        } else {
            table.clearSelection();
            for (int selectedRow : selectedRows) {
                table.addRowSelectionInterval(selectedRow, selectedRow);
            }
        }
    }
}

Related

  1. getSelectedModelRow(JTable table)
  2. moveRowSelection(JTable pJTable, int pRow)
  3. removeSelectedRowFromTable(JTable table)
  4. selectClickedRow(final JTable table, final MouseEvent event)
  5. selectLastTableRow(JTable table)
  6. tableModelToArray(JTable table, boolean onlyTheSelectedRows)