remove a colum from a DefaultTableModel
hi everyone, I have a DefaultTableModel that I built with tableModel.addColumn("dasdasfasfs"), thereafter I fill it with addRow.
I want to reuse the tableModel, but before I want to clear it (rows and columns) to add different columns and different rows.
for the rows:
for (int i = 0; i < this.tableModel.getRowCount(); i++) {
this.tableModel.removeRow(i);
}
but don't know how to remove the columns :(
thanks
Re: remove a colum from a DefaultTableModel
There are methods that set the column identifiers (setColumnIdentifiers(...)), which replace the current identifiers. Why not just instantiate a new instance?
Re: remove a colum from a DefaultTableModel
ok problem solved, use setColumnIdentifiers better than addColumn, it just replace columns, thanks copeg!