Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

using AbstractTableModel but want to add row

843804Feb 14 2005 — edited Mar 29 2005
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 26 2005
Added on Feb 14 2005
16 comments
401 views