Chapter 2. Sorting, Tables & Sorting Tables

Table of Contents

SortedList, a list transformation
Comparators, Comparable and SortedList
Using TableFormat to specify columns
The EventTableModel and TableComparatorChooser
So What?

Now that you've got "Hello World" out of the way, it's time to see Glazed Lists shine. You'll upgrade the JList to a JTable and let your users sort by clicking on the column headers.

SortedList, a list transformation

SortedList is a decorator that shows a source EventList in sorted order. Every TransformedList including SortedList listens for change events from a source EventList. When that source is changed, the TransformedList changes itself in response. By layering TransformedLists like SortedList and FilterList you can create flexible and powerful programs with ease.