Example usage for javax.swing ListSelectionModel MULTIPLE_INTERVAL_SELECTION

List of usage examples for javax.swing ListSelectionModel MULTIPLE_INTERVAL_SELECTION

Introduction

In this page you can find the example usage for javax.swing ListSelectionModel MULTIPLE_INTERVAL_SELECTION.

Prototype

int MULTIPLE_INTERVAL_SELECTION

To view the source code for javax.swing ListSelectionModel MULTIPLE_INTERVAL_SELECTION.

Click Source Link

Document

A value for the selectionMode property: select one or more contiguous ranges of indices at a time.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JTable table = new JTable();

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    table.setColumnSelectionAllowed(true);
    table.setRowSelectionAllowed(false);

    table.removeColumnSelectionInterval(0, 1);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    table.setColumnSelectionAllowed(true);
    table.setRowSelectionAllowed(false);

    table.clearSelection();//w  ww  .j av a 2 s  .c  o m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    table.setColumnSelectionAllowed(true);
    table.setRowSelectionAllowed(false);

    // Select an additional range of columns - columns 1 to 2
    table.addColumnSelectionInterval(1, 2);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    table.setColumnSelectionAllowed(true);
    table.setRowSelectionAllowed(true);//from w w w .  j  a v  a2s .c o m

    boolean toggle = true;
    boolean extend = false;
    table.changeSelection(1, 3, toggle, extend);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    table.setColumnSelectionAllowed(true);
    table.setRowSelectionAllowed(false);

    // Select a column - column 0
    table.setColumnSelectionInterval(0, 0);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    table.setColumnSelectionAllowed(true);
    table.setRowSelectionAllowed(false);

    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(true);//  w w  w. j a  va 2 s . c  om

    table.setRowSelectionInterval(0, 0);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    table.setColumnSelectionAllowed(true);
    table.setRowSelectionAllowed(false);

    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(true);//from  ww w  . j a  v a 2s.  c o m

    table.removeRowSelectionInterval(0, 1);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    table.setColumnSelectionAllowed(true);
    table.setRowSelectionAllowed(false);

    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(true);/*  w w w  . ja  v a2 s.c o m*/

    table.addRowSelectionInterval(1, 2);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    table.setColumnSelectionAllowed(true);
    table.setRowSelectionAllowed(true);/*from  w  ww .  jav  a  2s  .  c  o m*/

    int row = 2;
    int col = 1;
    boolean toggle = false;
    boolean extend = false;
    table.changeSelection(row, col, toggle, extend);
}