Where does the little triangle icon of sortable JTable header come from?
I am writting a cus开发者_如何学Ctomized component which need to use the little triangle icon of sortable JTable header. Maybe it's not really an icon file but a graphics painted by some class.
I believe the sort icon comes from the look and feel. For example, in the Windows look and feel, the WindowsTableHeaderUI
looks up the following to draw the appropriate icon. For ascending:
UIManager.getIcon("Table.ascendingSortIcon");
For descending:
UIManager.getIcon("Table.descendingSortIcon");
While the BasicLookAndFeel
registers a value for these properties (so there is likely to be something there if you use a similar call), as @Michael Borgwardt notes (by drawing a conclusion from his answer), there is no guarantee of this since any given look and feel might choose to forego the UIManager
and draw their own graphics.
Still, it might be worthwhile trying it to see if it does what you want.
Paiting those would be the job of a subclass of TableHeaderUI specific to the current Look-and-Feel. One L&F might load it from a file while another paints it as a vector graphic.
精彩评论