java - Sort JTable Except for Last Row -


i have jtable last row total row aggregates other rows. when user clicks column header on table, rows sorted column, except total row should @ bottom.

is there simple way implement tablerowsorter?

the following solution worked me....

in table model update getrowcount() member return 1 row less required.

then modify index , row counts reported sorter follows...

tablerowsorter<tablemodel> sorter =     new defaulttablerowsorter<tablemodel>(this.getmodel())  {     public int convertrowindextomodel(int index)     {         int maxrow = super.getviewrowcount();         if (index >= maxrow)             return index;         return super.convertrowindextomodel(index);     }      public int convertrowindextoview(int index)      {         int maxrow = super.getmodelrowcount();         if (index > maxrow)             return index;         return super.convertrowindextoview(index);     }      public int getviewrowcount()      {         return super.getviewrowcount() + 1;     } };  mytable.setrowsorter(sorter); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -