Controlling the visual behaviour of SortTableModel

Top  Previous  Next

 

SortTableModel installs a renderer on the table's header, so that to draw the mouse clicks, the sorting order and the sorting index. The renderer is an instance of the abstract class SortTableRenderer. By default, a SortTableButtonRenderer is employed, which uses a clickable JButton. SortTableButtonRenderer also shows the sorting order with an arrow pointing up or down accordingly, and the column sorting index as a number next to the column name.

 

You can use your own SortTableRenderer by overriding SortTableModel's method:

 

protected SortTableRenderer createDefaultSortTableRenderer();