List of usage examples for javax.swing JTable setRowSelectionAllowed
@BeanProperty(visualUpdate = true, description = "If true, an entire row is selected for each selected cell.") public void setRowSelectionAllowed(boolean rowSelectionAllowed)
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTable table = new JTable(4, 5); // 4 rows & 5 columns table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false); table.setCellSelectionEnabled(false); frame.add(new JScrollPane(table)); frame.setSize(300, 200);//from w ww . jav a2s . c o m frame.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTable table = new JTable(); table.setColumnSelectionAllowed(true); table.setRowSelectionAllowed(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTable table = new JTable(); table.setColumnSelectionAllowed(true); table.setRowSelectionAllowed(false); }
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.setColumnSelectionAllowed(true); table.setRowSelectionAllowed(true); int row = 1;// w w w . ja va 2 s .c o m int col = 3; boolean success = table.editCellAt(row, col); if (success) { 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.setColumnSelectionAllowed(true); table.setRowSelectionAllowed(true); int row = 1;//from ww w. ja v a 2 s . co m int col = 3; boolean success = table.editCellAt(row, col); if (success) { boolean toggle = false; boolean extend = false; table.changeSelection(row, col, toggle, extend); } if (table.getCellEditor() != null) { table.getCellEditor().cancelCellEditing(); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTable table = new JTable(); // Enable row selection (default) table.setColumnSelectionAllowed(false); table.setRowSelectionAllowed(true); }
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); // Enable the ability to select a single cell table.setColumnSelectionAllowed(true); table.setRowSelectionAllowed(true); if (table.getCellEditor() != null) { table.getCellEditor().stopCellEditing(); }//from w w w. j a v a2s . 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); 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 w w.j ava 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); }