Java Tutorial/Intermediate GUIs/Table with sorting

The class HotelTablePanel (cvs) together with HotelTableModel (cvs), HotelTableColumnModel (cvs) and HotelTableRowSorter (cvs) composes a table with row sorting and special rendering.

HotelTableRowSorter
The class  is merely a  specialized with type parameter. This is not strictly necessary but has been added for convenience, one could use  instead whereever   is used and this use would even reduce the number of classes in the program.

HotelTableColumnModel
The class  extends and contains the subclasses  and , which are derived from. The column model contains the specification and configuration of table columns and the renderers support specialized rendering of table cells.

The function in  returns a component suitable for cell rendering; this component is usually the same component instance for all cells of a table and is only reconfigured to render different content for each cell, unless a column requires its own rendering.

HotelTableModel
The class  is derived from and provides access to the data structures used for the table in the way the Swing table classes expect.

HotelTablePanel
The class  extends  and provides a visual container for a.

(source code from vsrs.svn.sourceforge.net)