本文整理匯總了Java中javax.swing.UIDefaults.getColor方法的典型用法代碼示例。如果您正苦於以下問題:Java UIDefaults.getColor方法的具體用法?Java UIDefaults.getColor怎麽用?Java UIDefaults.getColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.UIDefaults
的用法示例。
在下文中一共展示了UIDefaults.getColor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureScrollBarColors
import javax.swing.UIDefaults; //導入方法依賴的package包/類
@Override
protected void configureScrollBarColors() {
UIDefaults uidefaults = XToolkit.getUIDefaults();
Color bg = scrollbar.getBackground();
if (bg == null || bg instanceof UIResource) {
scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
}
Color fg = scrollbar.getForeground();
if (fg == null || fg instanceof UIResource) {
scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
}
thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
thumbColor = uidefaults.getColor("ScrollBar.thumb");
trackColor = uidefaults.getColor("ScrollBar.track");
trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");
}
示例2: setDefaultColors
import javax.swing.UIDefaults; //導入方法依賴的package包/類
protected void setDefaultColors()
{
UIDefaults defaults = UIManager.getDefaults();
ComponentName componentKey = getComponentName();
background = defaults.getColor(backgrounds.get(componentKey));
border = defaults.getColor(borders.get(componentKey));
darkShadow = defaults.getColor(darkShadows.get(componentKey));
disabledForeground = defaults.getColor(disabledForegrounds.get(componentKey));
disabledBackground = defaults.getColor(disabledBackgrounds.get(componentKey));
focus = defaults.getColor(focuses.get(componentKey));
foreground = defaults.getColor(foregrounds.get(componentKey));
highlight = defaults.getColor(highlights.get(componentKey));
light = defaults.getColor(lights.get(componentKey));
selectedForeground = defaults.getColor(selectedForegrounds.get(componentKey));
selectedBackground = defaults.getColor(selectedBackgrounds.get(componentKey));
shadow = defaults.getColor(shadows.get(componentKey));
}
示例3: setupUI
import javax.swing.UIDefaults; //導入方法依賴的package包/類
/**
* Set up the user interface.
*/
public static void setupUI() {
try {
final String classname = UIManager.getSystemLookAndFeelClassName();
UIManager.setLookAndFeel(classname);
}
catch (Exception e) {
e.printStackTrace();
}
final UIDefaults defaults = UIManager.getDefaults();
defaults.put(
"PopupMenu.border",
new BorderUIResource.EtchedBorderUIResource(
EtchedBorder.RAISED, defaults.getColor("controlShadow"),
defaults.getColor("controlLtHighlight")
)
);
final MatteBorder matteborder = new MatteBorder(1, 1, 1, 1, Color.black);
final EmptyBorder emptyborder = new MatteBorder(2, 2, 2, 2, defaults.getColor("control"));
final BorderUIResource.CompoundBorderUIResource compBorder
= new BorderUIResource.CompoundBorderUIResource(emptyborder, matteborder);
final BorderUIResource.EmptyBorderUIResource emptyBorderUI
= new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0);
defaults.put("SplitPane.border", emptyBorderUI);
defaults.put("Table.scrollPaneBorder", emptyBorderUI);
defaults.put("ComboBox.border", compBorder);
defaults.put("TextField.border", compBorder);
defaults.put("TextArea.border", compBorder);
defaults.put("CheckBox.border", compBorder);
defaults.put("ScrollPane.border", emptyBorderUI);
}