Where does the small triangle icon of the JTable sortable header come from?

I am writing a custom component that should use the small triangle icon of a JTable sortable header. Perhaps this is not an icon file, but a graphic written by some class.

+4
source share
2 answers

I believe the sort icon comes from the look. For example, in Windows standby mode, WindowsTableHeaderUI scans the following to draw the corresponding icon. For the upstream:

 UIManager.getIcon("Table.ascendingSortIcon"); 

For descent:

 UIManager.getIcon("Table.descendingSortIcon"); 

While BasicLookAndFeel registers a value for these properties (therefore, if you use a similar call, there may be something, as @Michael Borgwardt notes (drawing a conclusion from his answer), there is no guarantee of this, since any given appearance may prefer to abandon the UIManager and draw its own graphics.

However, it may be helpful to try to make it do what you need.

+12
source

Patenting these objects would be the task of the TableHeaderUI subclass specific to the current Look-and-Feel. One L & F can load it from a file, and the other - in the form of vector graphics.

+4
source

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


All Articles