java - How to have jtables values which are strings in alphabetical order using comparator and tablerowsorter? -


the title says clearly. wanted use quicksort algorithm 1 of friends said use comparator don't know how to.

you must create comparator:

comparator<string> comparator = new comparator<string>() {     public int compare(string s1, string s2) {          return s1.compareto(s2);     } }; 

with comparator able sort data in alphabetical order.

after create sorter , pass comparator , model of jtable.

then:

sorter.sort(); 

i think after data sorted.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -