2010-09-13 119 views

回答

10

對於Swing組件,你可以在應用廣泛UIDefaultsUIManager提供設置默認顏色:

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

對於特定的盒子。

通常他們將在創建UI時從SystemColor.textHighlightSystemColor.textHighlightText 中讀取。

9

UIMManager Defaults列出了一個很好的格式化GUI所有默認設置。

+0

哈哈,你寫的這個?這是一個非常棒的工具。 – davidahines 2012-04-20 16:15:05

+1

如果您只是查找變量名稱列表,您可以使用http://nadeausoftware.com/articles/2008/11/all_ui_defaults_names_common_java_look_and_feels_windows_mac_os_x_and_linux – Mgamerz 2015-07-01 18:14:20