How can I find out the default selection color in a JList, for example?Where are these colors stored?
For Swing components, you can get and set the default colors in the UIDefaults application provided by UIManager :
UIDefaults
UIManager
UIDefaults defaults = javax.swing.UIManager.getDefaults(); defaults.getColor("List.selectionBackground"); defaults.getColor("List.selectionForeground");
UIMManager Defaults lists all the default values ββin a well-formatted GUI.
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.
SystemColor.textHighlight
SystemColor.textHighlightText