public class NimbusLookAndFeel extends SynthLookAndFeel
NimbusLookAndFeel类。
| Constructor and Description |
|---|
NimbusLookAndFeel()
创建一个新的NimbusLookAndFeel。
|
| Modifier and Type | Method and Description |
|---|---|
UIDefaults |
getDefaults()
返回此SynthLookAndFeel的默认值。
|
protected Color |
getDerivedColor(Color color1, Color color2, float midPoint)
解码并返回从两个其他颜色之间的偏移导出的颜色。
|
protected Color |
getDerivedColor(Color color1, Color color2, float midPoint, boolean uiResource)
解码并返回从两个其他颜色之间的偏移导出的颜色。
|
Color |
getDerivedColor(String uiDefaultParentName, float hOffset, float sOffset, float bOffset, int aOffset, boolean uiResource)
获取派生颜色,派生颜色是共享实例,并且当其父UIDefault颜色更改时,颜色值将更改。
|
String |
getDescription()
返回此外观的文字说明。
|
Icon |
getDisabledIcon(JComponent component, Icon icon)
返回一个
Icon具有禁用外观。
|
String |
getID()
返回一个识别这种外观和感觉的字符串。
|
String |
getName()
返回一个标识这种外观和感觉的短字符串。
|
static NimbusStyle |
getStyle(JComponent c, Region r)
获取与给定组件和区域相关联的样式。
|
void |
initialize()
当这个外观和感觉被安装时,由UIManager打来的。
|
void |
register(Region region, String prefix)
使用NimbusLookAndFeel注册第三方组件。
|
boolean |
shouldUpdateStyleOnAncestorChanged()
返回的UI是否应该更新其
SynthStyles从
SynthStyleFactory时的祖先
JComponent变化。
|
protected boolean |
shouldUpdateStyleOnEvent(PropertyChangeEvent ev)
返回在特定事件发生时,UI是否应更新其样式。
|
void |
uninitialize()
当这个外观和感觉被卸载时,由UIManager打电话。
|
createUI, getRegion, getStyleFactory, isNativeLookAndFeel, isSupportedLookAndFeel, load, load, setStyleFactory, updateStylescreateAudioAction, getAudioActionMap, initClassDefaults, initComponentDefaults, initSystemColorDefaults, loadSystemColors, playSoundgetDesktopPropertyValue, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorderpublic void initialize()
public void uninitialize()
public UIDefaults getDefaults()
public static NimbusStyle getStyle(JComponent c, Region r)
c - 对
c的非空引用
r - 对组件c的区域的非空引用
public String getName()
getName在
SynthLookAndFeel
public String getID()
getID在
SynthLookAndFeel
public String getDescription()
getDescription在
SynthLookAndFeel
public boolean shouldUpdateStyleOnAncestorChanged()
SynthStyles更新SynthStyleFactory当祖先的JComponent发生变化。
提供一个基于SynthStyleFactory的返回值从getStyle离开包含层次结构的子类将覆盖此方法返回true。
shouldUpdateStyleOnAncestorChanged在
SynthLookAndFeel
true
protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev)
当以下属性之一更改时,覆盖返回true :
"Nimbus.Overrides" "Nimbus.Overrides.InheritDefaults" "JComponent.sizeVariant" shouldUpdateStyleOnEvent在类
SynthLookAndFeel
ev - a
PropertyChangeEvent
public void register(Region region, String prefix)
使用NimbusLookAndFeel注册第三方组件。
区域代表作为独立绘画区域的组件内的组件和区域。 一旦注册了NimbusLookAndFeel,这些区域的getStyle可以通过getStyle方法getStyle 。
NimbusLookAndFeel对UIDefaults表中的条目使用标准命名方案。 在特定区域的UIDefaults中注册的每个财产,州,画家和其他默认值的关键字将以指定的prefix prefix
例如,假设我有一个名为JFoo的组件。 假设我以这种方式用NimbusLookAndFeel注册了这个组件:
laf.register(NimbusFooUI.FOO_REGION, "Foo");
在这种情况下,我可以使用以下方式使用UIDefaults注册此组件的属性:
UIManager.put("Foo.background", new ColorUIResource(Color.BLACK)); UIManager.put("Foo.Enabled.backgroundPainter", new FooBackgroundPainter());
也可以使用Nimbus注册一个命名的组件。 例如,假设您想要将名为“MyPanel”的JPanel的背景与其他JPanels不同。 您可以通过执行以下操作来完成此操作:
laf.register(Region.PANEL, "\"MyPanel\""); UIManager.put("\"MyPanel\".background", new ColorUIResource(Color.RED));
region - 正在注册的合成区域。
如Button或ScrollBarThumb,或NimbusFooUI.FOO_REGION。
prefix - UIDefault前缀。
例如,可以是ComboBox,或者如果一个命名组件,“MyComboBox”,甚至像ToolBar这样的东西。“MyComboBox”。“ComboBox.arrowButton”
public Icon getDisabledIcon(JComponent component, Icon icon)
LookAndFeel
Icon具有禁用外观。
这种方法被用于产生一个禁用Icon时,未指定的一个。
例如,如果您创建一个JButton并且仅通过setIcon指定一个Icon , setIcon此方法来生成禁用的Icon 。
如果null传递为icon此方法返回null 。
有些看起来和感觉可能不会使残疾人Icon ,在这种情况下他们会忽略这个。
getDisabledIcon在
LookAndFeel类
component -
JComponent将显示
Icon ,可能是
null
icon -
Icon生成禁用图标
Icon或
null如果合适的
Icon不能生成
public Color getDerivedColor(String uiDefaultParentName, float hOffset, float sOffset, float bOffset, int aOffset, boolean uiResource)
uiDefaultParentName - 父UIDefault键
hOffset - 色相偏移
sOffset - 饱和偏移
bOffset - 亮度偏移
aOffset - alpha偏移量
uiResource - 如果派生颜色应为UIResource,则为真,如果不应该为false
protected final Color getDerivedColor(Color color1, Color color2, float midPoint, boolean uiResource)
color1 - 第一种颜色
color2 - 第二种颜色
midPoint - 颜色1和颜色2之间的偏移值为0.0是颜色1和1.0是颜色2;
uiResource - 如果派生的颜色应该是
uiResource ,则为真
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.