开发者

Java Get Default UI Colors

开发者 https://www.devze.com 2023-01-16 12:46 出处:网络
How could I find out the default selection color in a JList for example? Whe开发者_高级运维re are these colors are stored?For Swing components you can get and set the default colors in the application

How could I find out the default selection color in a JList for example?

Whe开发者_高级运维re are these colors are stored?


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

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


UIMManager Defaults lists all the defaults in a nicely formatted GUI.


JList.getSelectionForeground();
JList.getSelectionBackground();

for that particular box.

Usually they will be read from SystemColor.textHighlight and SystemColor.textHighlightText at the time the UI is created.

0

精彩评论

暂无评论...
验证码 换一张
取 消