📄 e923. moving a column in a jtable component.txt
字号:
Moving a column requires the index of the column to be moved and a position specified. The index of a column is 0-based; the first column has index 0. Positions are locations between columns. For example, if there are 2 columns in a table, there are 3 possible position - - 0, 1,and 2. Moving a column to position 0 makes the column the first column. Moving a column to position 2 makes the column the last column.
int rows = 10;
int cols = 5;
JTable table = new JTable(rows, cols);
// Move the last visible column so it becomes the first visible column
int vSrcColIndex = table.getColumnCount()-1;
int vDstColIndex = 0;
table.moveColumn(vSrcColIndex, vDstColIndex);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -