|
|
@ -102,25 +102,20 @@ public class TableDemo implements ComponentDemo { |
|
|
|
setSelected(header.getReorderingAllowed()); |
|
|
|
setSelected(header.getReorderingAllowed()); |
|
|
|
addActionListener(e -> header.setReorderingAllowed(isSelected())); |
|
|
|
addActionListener(e -> header.setReorderingAllowed(isSelected())); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
JRadioButton column = new JRadioButton("column selection allowed") {{ |
|
|
|
controlPanel.add(new JCheckBox("cell selection") {{ |
|
|
|
|
|
|
|
setSelected(table.getCellSelectionEnabled()); |
|
|
|
|
|
|
|
addActionListener(e -> table.setCellSelectionEnabled(isSelected())); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
controlPanel.add(new JCheckBox("column selection") {{ |
|
|
|
setSelected(table.getColumnSelectionAllowed()); |
|
|
|
setSelected(table.getColumnSelectionAllowed()); |
|
|
|
addActionListener(e -> { |
|
|
|
addActionListener(e -> table.setColumnSelectionAllowed(isSelected())); |
|
|
|
table.setColumnSelectionAllowed(isSelected()); |
|
|
|
table.addPropertyChangeListener(e -> setSelected(table.getColumnSelectionAllowed())); |
|
|
|
table.setRowSelectionAllowed(!isSelected()); |
|
|
|
}}); |
|
|
|
}); |
|
|
|
controlPanel.add(new JCheckBox("row selection") {{ |
|
|
|
}}; |
|
|
|
|
|
|
|
JRadioButton row = new JRadioButton("row selection allowed") {{ |
|
|
|
|
|
|
|
setSelected(table.getRowSelectionAllowed()); |
|
|
|
setSelected(table.getRowSelectionAllowed()); |
|
|
|
addActionListener(e -> { |
|
|
|
addActionListener(e -> table.setRowSelectionAllowed(isSelected())); |
|
|
|
table.setRowSelectionAllowed(isSelected()); |
|
|
|
table.addPropertyChangeListener(e -> setSelected(table.getRowSelectionAllowed())); |
|
|
|
table.setColumnSelectionAllowed(!isSelected()); |
|
|
|
}}); |
|
|
|
}); |
|
|
|
|
|
|
|
}}; |
|
|
|
|
|
|
|
ButtonGroup group = new ButtonGroup(); |
|
|
|
|
|
|
|
group.add(column); |
|
|
|
|
|
|
|
group.add(row); |
|
|
|
|
|
|
|
controlPanel.add(column); |
|
|
|
|
|
|
|
controlPanel.add(row); |
|
|
|
|
|
|
|
return panel; |
|
|
|
return panel; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|