Ok, this is not exactly the same asor your other post with a sample of what you wanted as a table with apparently just 2 columns.
So, starting with this table:
Code:
| Col 0 | Col 1 | Col 2 | Col 3 | Col 4 | Col 5 | Col 6 |
| 1st | 2nd | 3rd | 4th | 5th | 6th | 7th |
do you want to end with this table (2nd, 4th, 5th, and 6th columns removed):
Code:
| Col 0 | Col 2 | Col 6 |
| 1st | 3rd | 7th |
or this one (columns with indexes 2, 4, 5, and 6 removed):
Code:
| Col 0 | Col 1 | Col 3 |
| 1st | 2nd | 4th |
To get the first result use this:
Code:
// remove column at index 1 (2nd)
// | Col 0 | Col 2 | Col 3 | Col 4 | Col 5 | Col 6 |
// | 1st | 3rd | 4th | 5th | 6th | 7th |
StatsTable.removeColumn(StatsTable.getColumnModel().getColumn(1));
// remove column now at index 2 (4th)
// | Col 0 | Col 2 | Col 4 | Col 5 | Col 6 |
// | 1st | 3rd | 5th | 6th | 7th |
StatsTable.removeColumn(StatsTable.getColumnModel().getColumn(2));
// remove column now at index 2 (5th)
// | Col 0 | Col 2 | Col 5 | Col 6 |
// | 1st | 3rd | 6th | 7th |
StatsTable.removeColumn(StatsTable.getColumnModel().getColumn(2));
// remove column now at index 2 (6th)
// | Col 0 | Col 2 | Col 6 |
// | 1st | 3rd | 7th |
StatsTable.removeColumn(StatsTable.getColumnModel().getColumn(2));
For the second option use this:
Code:
// remove column at index 2 (3rd)
// | Col 0 | Col 1 | Col 3 | Col 4 | Col 5 | Col 6 |
// | 1st | 2nd | 4th | 5th | 6th | 7th |
StatsTable.removeColumn(StatsTable.getColumnModel().getColumn(2));
// remove column now at index 3 (5th)
// | Col 0 | Col 1 | Col 3 | Col 5 | Col 6 |
// | 1st | 2nd | 4th | 6th | 7th |
StatsTable.removeColumn(StatsTable.getColumnModel().getColumn(3));
// remove column now at index 3 (6th)
// | Col 0 | Col 1 | Col 3 | Col 6 |
// | 1st | 2nd | 4th | 7th |
StatsTable.removeColumn(StatsTable.getColumnModel().getColumn(3));
// remove column now at index 3 (7th)
// | Col 0 | Col 1 | Col 3 |
// | 1st | 2nd | 4th |
StatsTable.removeColumn(StatsTable.getColumnModel().getColumn(3));