📄 e963. sharing a table model between jtable components.txt
字号:
When you share a table model between two table components, any changes made to values in the model will appear in both table components. However, any changes to the visible columns in one table component will not affect the columns in the other table component.
DefaultTableModel model = new DefaultTableModel();
JTable table1 = new JTable(model);
JTable table2 = new JTable(model);
// Add data here
// Place the two tables in a split pane
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.add(new JScrollPane(table1));
splitPane.add(new JScrollPane(table2));
// Remove the first visible column from table1;
// the column will not be removed from table2
table1.getColumnModel().removeColumn(table1.getColumnModel().getColumn(0));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -