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!

JTable - Tri-state row sorting?

802962Oct 4 2010 — edited Oct 6 2010
I am trying to (easily) have some way to make the third click on a JTable column header make the column unsorted again. Since our tables are simple, we just use setAutoCreateRowSorter(true) on our tables, but we have a request to be able to remove sorting once you have sorted a column.

TLDR:
First click on column header: sort ascending
Second click on column header: sort descending
Third click on column header: remove sorting <------------ this is what we want.

Does anyone know of a quick way to accomplish this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 3 2010
Added on Oct 4 2010
5 comments
798 views