my table use DefaultTableModel. And I live happily..... i can add row at runtime by:
DefaultTableModel boo = (DefaultTableModel)table.getModel();
boo.addrow( blablabal);
Then I need to implement the sorting by clicking jtable header capabilities. I use TableSorter.java by java tutorial example:
http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/TableSorter.java
But tablesorter extends AbstractTableModel which does not have adding row capability.
What should I do???
I try to add adding row capability into tablesorter.... but after reading this from searching threads:
The real question is why are you attempting to creating a new table model by extending AbstractTableModel. You are building the table with a two dimensional array which is supported by the DefaultTableModel. You do not appear to be adding any new funtionality? Just use the DefaultTableModel.
Is add adding row capability to tablesorter is that hard?????? If it is too hard, I think to switch back to defaulttablemodel since I can sort the jtable with sql statement "order by" ( yeah, my jtable display database data through jdbc ). I am java newbie anyway.