permaculture playing cards
The moose likes Swing / AWT / SWT and the fly likes Row selections after sorting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Row selections after sorting " Watch "Row selections after sorting " New topic

Row selections after sorting

Mi Chu

Joined: Dec 17, 2013
Posts: 13
I am having issues with keeping the row selection after sorting the data. That is, if I select result1 in row1 and sort the column, I still have row1 selected, but some other result, say result8 is in that row. How do I keep that selection locked to the result, instead of row?

Row selection

Sort method

I tried
but, this doesnt work.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2454
Don't attempt to manage this yourself. The built in JTable support will manage this for you.

Read the section from the Swing tutorial on Sorting and Filtering for a working example.
I agree. Here's the link:
subject: Row selections after sorting
It's not a secret anymore!