A JTable that allows the user to sort the table by clicking on the column headers. An icon is shown in the sort column to indicate the sort. Ascending and descending sorting is supported.
Sorting depends on the java.lang.Comparable interface. SortedJTable will attempt to compare the cell contents using Comparable. If the contents are not Comparable, then their toString() values are compared. Note that all the Java primitive wrapper objects (Integer, Double, etc) implement Comparable, so you'll get better sorting (1, 5, 10 instead of 1, 10, 5) if you use, for example, Integers instead of Strings.
This code was developed by NASA, Goddard Space Flight Center, Code 588 for the Scientist's Expert Assistant (SEA) project.
@version 10/27/99
@author Kong Eu Tak (for Swing Connection Article)
@author J. Jones / 588
@author A. Brighton (changes, additions, fixes, performance improvements)
@see java.lang.Comparable