Java UI color colors

How can I find out the default selection color in a JList, for example?
Where are these colors stored?

+6
java
source share
3 answers

For Swing components, you can get and set the default colors in the UIDefaults application provided by UIManager :

 UIDefaults defaults = javax.swing.UIManager.getDefaults(); defaults.getColor("List.selectionBackground"); defaults.getColor("List.selectionForeground"); 
+10
source share

UIMManager Defaults lists all the default values ​​in a well-formatted GUI.

+9
source share
 JList.getSelectionForeground(); JList.getSelectionBackground(); 

for this particular window.

They are usually read from SystemColor.textHighlight and SystemColor.textHighlightText at the time the user interface is created.

+7
source share

All Articles