Sorting JTable on more than just the values listed in the columns
Posted on
16th Feb 2014 07:03 pm by
admin
I have a collection of objects that store (among other things) two integer values. I only want to display one of these values. The displayed value will dictate the sort order of the JTable.
However, I want to break ties with the other, undisplayed, integer value.
Did you know?Explore Trending and Topic pages for more stories like this.
I've gone through the trouble of specifying my own Comparator for the TableRowSorter. However, this method doesn't have access to the row index into the table. It is only passed the values in the column that is being sorted, not their position in the column. Without having a reference back to the row index (which I use as an index to the collection of objects) I cannot get the secondary value, unless I also display this value in its own column and sort on Sort Keys.
I don't want to do that, because I feel it clutters up the look of the table.
For example, I have the two sets of numbers
Row Name | Displayed Value | Undisplayed Value
rowA | 7 | 3
rowB | 7 | 5
With this set of data, rowB should be listed above rowA. Any ideas on how to implement this.
I'm pretty new to Swing, so there could be something simple that I'm missing (hopefully).
No comments posted yet
Your Answer:
Login to answer
296
12
Other forums
do while conditions
i want to display 6 images in a 2x3 table
now what would be the correct logic to
count that th
AJAX form submit
I recently built a form that submits data to my database with an ajax function that is called throug
mail()
Hi all. I have a problem with emails. I am trying to set up a mail system where customers can subscr
=> and <=
So I was digging through some code when I came across the <= operator. This is the first tim
Javascript form submit and radio buttons?
When this form is submitted, it is automatically resubmitted using JS.
All my fields are carr
1,000 select boxes with 100 options?!
I have 1 drop down select box with 1,000 options.
In some case, there will be 100+ of the
Matchcode in ALV change header column
Hello everyone,
I am working in an SAP system that is currently in upgrade and conversion
Disable Scrollbar in TableControl
Hello everbody,
please can anybody help me - outherwise i'm going to become desperate :P<
switch not getting value
what am i doing wrong?
i want to populate the country list according to the category
i want to
writing my own sobel filter convolution - something is wrong
I am trying to keep it very simple, I cant see anything wrong with my logic, could anybody help poin