List of usage examples for javax.swing JTable JTable
public JTable(final Object[][] rowData, final Object[] columnNames)
JTable
to display the values in the two dimensional array, rowData
, with column names, columnNames
. 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();//from w w w. j a v a 2 s. co 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 { JTable table = new JTable(10, 5); int rowIndex = 1; int vColIndex = 2; scrollToVisible(table, rowIndex, vColIndex); }
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);/*w ww . j a v a2 s. 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 ww .j a v a 2 s .c o m 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 ava 2 s . 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 .j a 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);// w ww . ja v a2s. com int row = 2; int col = 1; boolean toggle = false; boolean extend = false; table.changeSelection(row, col, 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(true);/*from w ww.j av a 2 s . c o m*/ int row = 3; int col = 2; boolean toggle = true; boolean extend = false; table.changeSelection(row, col, toggle, extend); }