Java: Selected rows's index does not changes when I sort them!
Posted
by adrian7
on Stack Overflow
See other posts from Stack Overflow
or by adrian7
Published on 2010-04-17T09:48:24Z
Indexed on
2010/04/17
9:53 UTC
Read the original article
Hit count: 255
Hello, I have a Jtable on which I called the method
table1.setAutoCreateRowSorter(true);
.
So this works on well.
But I also have a methos in my JFrame class which is fired when i push a button. It gets the selected rows indexes using this code
int selectedRows[] = this.table1.getSelectedRows();
.
And displays an edit window for the first row corresponding in the selected interval.
The problem is that if I don't click on column's headers (I mean i don't sorte them at all) my method works perfect. But when I sort the row, the indexes of the rows doesn't seems to change at all - thus resulting an edit window for the old row whicn was initially in that position before making any sort.
I am using JDK 6 could anyonw give ma a tip?
© Stack Overflow or respective owner