JTable string sorting in Java 1.5

Is there an easy way to sort strings in JTable with Java 1.5 ( setAutoCreateRowSorterand TableRowSorterare Java 1.6 features)?

+2
source share
3 answers

Sorting in Java 1.5 is only possible through libraries.

eg. use the JXTable mentioned from Kaarel or VLTable from here .

Another good library is glazedlists

which is also used in the Spring Rich Client project.

There are even ways to use Glazed Lists with JXTable

+2
source

Use JXTablefrom a SwingX project , for example,

+1

JXTable , . ( 1.0 Java 1.5).

TableSorter.java. :

http://ouroborus.org/java/2.1/TableSorter.java

.

tableModel TableSorter JTable. TableSorter "" JTable- tableModel.

- ( ):

JTable myTable = new JTable();
TableSorter mySorter = new TableSorter(myTableModel, myTable.getTableHeader());
myTable.setTableModel(mySorter);

sprting :

mySorter.setSortingStatus(0,TableSorter.ASCENDING);

tweeking MouseHandler.mouseClicked(), NOT_SORTED .

0

Source: https://habr.com/ru/post/1740798/


All Articles