Can you use TableRowSorter with a Row Header Table/Main Table

Hi, Im moving from Java 1.4 to Java 1.6. In my application I have a JTable within a scrollpane, and another JTable within the scrollpanes Rowheader pane, both JTables use the same TableModel. Ive done it this way to get the standard spreadsheet/excel look which allows the main table columns to be scrolled left and right, but the rowheader table which just consists of a rownumber always stays on the lefthandside and cannot be resized/moved.

I was using the common TableSorter/Decorator method of column sorting, because both tables use the same model both tables are updated correctly when a sort is done on a column in either table.

The new sorting seems to be JTable based rather than TableModel based, how can I get the other JTable to update and be sorted the same as the for which the column is clicked on. (I also want to do filtering something that my current app doesnt do which is another reason why I would like to move to java 1.6)

[964 byte] By [paultaylora] at [2007-11-26 16:59:08]
# 1

I have the same issue, and am very interested in hearing how to handle it. In order for the Row Header Table to stay in sync with the sorting on the Main Table I have shared the table sorter for both tables.When the columns of the Main Table are clicked it works as expected - both tables are sorted properly. However, when the Row Header Table's sole column header is clicked the sorting is done based on the first column of Main Table which is an unexpected and undesirable affect.

PhoebusApolloa at 2007-7-8 23:26:56 > top of Java-index,Desktop,Core GUI APIs...
# 2

In the end I couldnt move to Java 1.6, I have just gone to Java 1.5.,

Ive been using the swingx project and the way I got round the problem (with help) was to have the main table have a hidden column which contained the row numbers the same as the row number record number. When the user selected to sort by the record number I directed them to sort by the hidden column in the main table. The row header table listens to changes in the main tables sorter and sorts accordingly. I dont know if you use the same method with vanilla 1.6 libraries.

link to thread here: http://forums.java.net/jive/thread.jspa?threadID=22382&tstart=30

paultaylora at 2007-7-8 23:26:56 > top of Java-index,Desktop,Core GUI APIs...