List of usage examples for javax.swing JTable setColumnSelectionAllowed
@BeanProperty(visualUpdate = true, description = "If true, an entire column is selected for each selected cell.") public void setColumnSelectionAllowed(boolean columnSelectionAllowed)
From source file:Main.java
public static void main(String[] argv) throws Exception { JTable table = new JTable(); table.setColumnSelectionAllowed(true); table.setRowSelectionAllowed(true);/*from ww w . j a va2 s .c om*/ }
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);/* w ww.j a v a2 s.c o m*/ int row = 1; 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);//from w w w.j av a 2s . c o m int row = 1; 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 w w w . ja v a2 s . c om*/ }
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);//from w ww .j a va 2s . co m if (table.getCellEditor() != null) { table.getCellEditor().stopCellEditing(); } }
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.ja v a2 s .co m frame.setVisible(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); 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. ja va 2 s.com }
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); }