e963. sharing a table model between jtable components.txt
来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 17 行
TXT
17 行
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 + =
减小字号Ctrl + -
显示快捷键?