public class MetalLookAndFeel extends BasicLookAndFeel
每个MetalLookAndFeel
提供的ComponentUI
s推导其行为从缺省值表。除非另有说明,每个在这个文件包设置默认他们使用ComponentUI
实现。除非另有说明,默认安装在时间installUI
被调用,并遵循了LookAndFeel
安装默认的建议。
MetalLookAndFeel
是来自MetalTheme
的颜色和字体。默认的主题是OceanTheme
。主题可以使用setCurrentTheme
方法改变,称其为改变主题的细节。1.5之前的默认主题是DefaultMetalTheme
。系统性"swing.metalTheme"
可以设置"steel"
表示默认应该是DefaultMetalTheme
。
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans
包。请看XMLEncoder
。
MetalTheme
,
DefaultMetalTheme
,
OceanTheme
Constructor and Description |
---|
MetalLookAndFeel() |
createAudioAction, getAudioActionMap, initialize, loadSystemColors, playSound, uninitialize
getDesktopPropertyValue, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, toString, uninstallBorder
public String getName()
"Metal"
。
getName
方法重写,继承类
LookAndFeel
public String getID()
"Metal"
。
getID
方法重写,继承类
LookAndFeel
public String getDescription()
"The Java(tm) Look and Feel"
。
getDescription
方法重写,继承类
LookAndFeel
public boolean isNativeLookAndFeel()
false
;
MetalLookAndFeel
不是本地的外观和感觉。
isNativeLookAndFeel
方法重写,继承类
LookAndFeel
false
public boolean isSupportedLookAndFeel()
true
;
MetalLookAndFeel
可以运行于任何平台。
isSupportedLookAndFeel
方法重写,继承类
LookAndFeel
true
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
public boolean getSupportsWindowDecorations()
true
;金属可以提供
Window
装饰品。
getSupportsWindowDecorations
方法重写,继承类
LookAndFeel
true
JDialog.setDefaultLookAndFeelDecorated(boolean)
,
JFrame.setDefaultLookAndFeelDecorated(boolean)
,
JRootPane.setWindowDecorationStyle(int)
protected void initClassDefaults(UIDefaults table)
uiClassID
table
映射到UI类的完全限定名。
MetalLookAndFeel
寄存器在包
javax.swing.plaf.metal
,命名为metalxxxui每个类的入口。字符串是一
XXX
摆动的uiclassids。对于不在金属类的
uiClassIDs
,在
javax.swing.plaf.basic
相应类的使用。例如,金属没有一个名为
"MetalColorChooserUI"
,这样,
javax.swing.plaf.basic.BasicColorChooserUI
使用。
initClassDefaults
方法重写,继承类
BasicLookAndFeel
table
-
UIDefaults
审的项目添加到
null
table
NullPointerException
BasicLookAndFeel.initClassDefaults(javax.swing.UIDefaults)
protected void initSystemColorDefaults(UIDefaults table)
table
系统。下面的值添加到
table
:
Key | Value |
---|---|
"desktop" | theme.getDesktopColor() |
"activeCaption" | theme.getWindowTitleBackground() |
"activeCaptionText" | theme.getWindowTitleForeground() |
"activeCaptionBorder" | theme.getPrimaryControlShadow() |
"inactiveCaption" | theme.getWindowTitleInactiveBackground() |
"inactiveCaptionText" | theme.getWindowTitleInactiveForeground() |
"inactiveCaptionBorder" | theme.getControlShadow() |
"window" | theme.getWindowBackground() |
"windowBorder" | theme.getControl() |
"windowText" | theme.getUserTextColor() |
"menu" | theme.getMenuBackground() |
"menuText" | theme.getMenuForeground() |
"text" | theme.getWindowBackground() |
"textText" | theme.getUserTextColor() |
"textHighlight" | theme.getTextHighlightColor() |
"textHighlightText" | theme.getHighlightedTextColor() |
"textInactiveText" | theme.getInactiveSystemTextColor() |
"control" | theme.getControl() |
"controlText" | theme.getControlTextColor() |
"controlHighlight" | theme.getControlHighlight() |
"controlLtHighlight" | theme.getControlHighlight() |
"controlShadow" | theme.getControlShadow() |
"controlDkShadow" | theme.getControlDarkShadow() |
"scrollbar" | theme.getControl() |
"info" | theme.getPrimaryControl() |
"infoText" | theme.getPrimaryControlInfo() |
theme
对应于当前
MetalTheme
。
initSystemColorDefaults
方法重写,继承类
BasicLookAndFeel
table
-
UIDefaults
对象的值添加到
null
table
NullPointerException
SystemColor
,
BasicLookAndFeel.getDefaults()
,
BasicLookAndFeel.loadSystemColors(javax.swing.UIDefaults, java.lang.String[], boolean)
protected void initComponentDefaults(UIDefaults table)
table
金属与默认值。
initComponentDefaults
方法重写,继承类
BasicLookAndFeel
table
-
UIDefaults
加值
null
table
NullPointerException
protected void createDefaultTheme()
MetalTheme
是
non-null
。这是一个
getCurrentTheme
覆盖法。
getCurrentTheme()
public UIDefaults getDefaults()
createDefaultTheme()
,
super.getDefaults()
和
getCurrentTheme().addCustomEntriesToTable(table)
。
虽然这种方法是公共的,它必须由UIManager
调用当外观设置为当前的外观和感觉,initialize
后被调用。
getDefaults
方法重写,继承类
BasicLookAndFeel
createDefaultTheme()
,
BasicLookAndFeel.getDefaults()
,
MetalTheme.addCustomEntriesToTable(UIDefaults)
public void provideErrorFeedback(Component component)
JTextField
有焦点的粘贴。默认实现的哔哔声。希望不同的行为的子类应该重写这个,并提供额外的反馈。
provideErrorFeedback
方法重写,继承类
LookAndFeel
component
-
Component
发生错误,可能是
null
指示错误条件不直接与
Component
相关
public static void setCurrentTheme(MetalTheme theme)
MetalLookAndFeel
主题。
在主题设置,MetalLookAndFeel
需要重新安装和用户界面需要重新创建。下面的说明如何做到这一:
metallookandfeel setcurrenttheme(主题);重新安装金属外观和感觉缺省情况(新metallookandfeel())”;/ /更新所有组件的componentuis。这所有窗口都需要调用。swingutilities updatecomponenttreeui(rootcomponent);如果不这样做的结果是不确定的。
theme
-主题使用
null
theme
NullPointerException
getCurrentTheme()
public static MetalTheme getCurrentTheme()
MetalLookAndFeel
。如果当前的主题是
null
,默认的主题是创造。
setCurrentTheme(javax.swing.plaf.metal.MetalTheme)
public Icon getDisabledIcon(JComponent component, Icon icon)
Icon
外观。这种方法是用来产生一个残疾人
Icon
时未指定。例如,如果你创建了一个
JButton
只指定一个
Icon
通过
setIcon
这个方法来生成禁用
Icon
。如果传递null作为
icon
方法返回null。
一些外观和感觉可能不会渲染禁用图标,在这种情况下,他们会忽略这个。
getDisabledIcon
方法重写,继承类
LookAndFeel
component
-组件将显示图标,可能是空的
icon
图标生成禁用图标。
public Icon getDisabledSelectedIcon(JComponent component, Icon icon)
Icon
供残疾人使用的组件,并选择。这种方法被用来生成
Icon
组件,在残疾人和选定的国家却没有这种状态的具体
Icon
。例如,如果你创建了一个
JButton
只指定一个
Icon
通过
setIcon
这个方法来生成禁用和选择
Icon
。如果为空,是为
icon
此方法返回null传递。
一些外观和感觉可能不会渲染禁用和选定的图标,在这种情况下,他们会忽略这个。
getDisabledSelectedIcon
方法重写,继承类
LookAndFeel
component
-组件将显示图标,可能是空的
icon
图标生成残疾和选定的图标。
public static FontUIResource getControlTextFont()
getCurrentTheme().getControlTextColor()
覆盖法。
MetalTheme
public static FontUIResource getSystemTextFont()
getCurrentTheme().getSystemTextFont()
覆盖法。
MetalTheme
public static FontUIResource getUserTextFont()
getCurrentTheme().getUserTextFont()
覆盖法。
MetalTheme
public static FontUIResource getMenuTextFont()
getCurrentTheme().getMenuTextFont()
覆盖法。
MetalTheme
public static FontUIResource getWindowTitleFont()
getCurrentTheme().getWindowTitleFont()
覆盖法。
MetalTheme
public static FontUIResource getSubTextFont()
getCurrentTheme().getSubTextFont()
覆盖法。
MetalTheme
public static ColorUIResource getDesktopColor()
getCurrentTheme().getDesktopColor()
覆盖法。
MetalTheme
public static ColorUIResource getFocusColor()
getCurrentTheme().getFocusColor()
覆盖法。
MetalTheme
public static ColorUIResource getWhite()
getCurrentTheme().getWhite()
覆盖法。
MetalTheme
public static ColorUIResource getBlack()
getCurrentTheme().getBlack()
覆盖法。
MetalTheme
public static ColorUIResource getControl()
getCurrentTheme().getControl()
覆盖法。
MetalTheme
public static ColorUIResource getControlShadow()
getCurrentTheme().getControlShadow()
覆盖法。
MetalTheme
public static ColorUIResource getControlDarkShadow()
getCurrentTheme().getControlDarkShadow()
覆盖法。
MetalTheme
public static ColorUIResource getControlInfo()
getCurrentTheme().getControlInfo()
覆盖法。
MetalTheme
public static ColorUIResource getControlHighlight()
getCurrentTheme().getControlHighlight()
覆盖法。
MetalTheme
public static ColorUIResource getControlDisabled()
getCurrentTheme().getControlDisabled()
覆盖法。
MetalTheme
public static ColorUIResource getPrimaryControl()
getCurrentTheme().getPrimaryControl()
覆盖法。
MetalTheme
public static ColorUIResource getPrimaryControlShadow()
getCurrentTheme().getPrimaryControlShadow()
覆盖法。
MetalTheme
public static ColorUIResource getPrimaryControlDarkShadow()
getCurrentTheme().getPrimaryControlDarkShadow()
覆盖法。
MetalTheme
public static ColorUIResource getPrimaryControlInfo()
getCurrentTheme().getPrimaryControlInfo()
覆盖法。
MetalTheme
public static ColorUIResource getPrimaryControlHighlight()
getCurrentTheme().getPrimaryControlHighlight()
覆盖法。
MetalTheme
public static ColorUIResource getSystemTextColor()
getCurrentTheme().getSystemTextColor()
覆盖法。
MetalTheme
public static ColorUIResource getControlTextColor()
getCurrentTheme().getControlTextColor()
覆盖法。
MetalTheme
public static ColorUIResource getInactiveControlTextColor()
getCurrentTheme().getInactiveControlTextColor()
覆盖法。
MetalTheme
public static ColorUIResource getInactiveSystemTextColor()
getCurrentTheme().getInactiveSystemTextColor()
覆盖法。
MetalTheme
public static ColorUIResource getUserTextColor()
getCurrentTheme().getUserTextColor()
覆盖法。
MetalTheme
public static ColorUIResource getTextHighlightColor()
getCurrentTheme().getTextHighlightColor()
覆盖法。
MetalTheme
public static ColorUIResource getHighlightedTextColor()
getCurrentTheme().getHighlightedTextColor()
覆盖法。
MetalTheme
public static ColorUIResource getWindowBackground()
getCurrentTheme().getWindowBackground()
覆盖法。
MetalTheme
public static ColorUIResource getWindowTitleBackground()
getCurrentTheme().getWindowTitleBackground()
覆盖法。
MetalTheme
public static ColorUIResource getWindowTitleForeground()
getCurrentTheme().getWindowTitleForeground()
覆盖法。
MetalTheme
public static ColorUIResource getWindowTitleInactiveBackground()
getCurrentTheme().getWindowTitleInactiveBackground()
覆盖法。
MetalTheme
public static ColorUIResource getWindowTitleInactiveForeground()
getCurrentTheme().getWindowTitleInactiveForeground()
覆盖法。
MetalTheme
public static ColorUIResource getMenuBackground()
getCurrentTheme().getMenuBackground()
覆盖法。
MetalTheme
public static ColorUIResource getMenuForeground()
getCurrentTheme().getMenuForeground()
覆盖法。
MetalTheme
public static ColorUIResource getMenuSelectedBackground()
getCurrentTheme().getMenuSelectedBackground()
覆盖法。
MetalTheme
public static ColorUIResource getMenuSelectedForeground()
getCurrentTheme().getMenuSelectedForeground()
覆盖法。
MetalTheme
public static ColorUIResource getMenuDisabledForeground()
getCurrentTheme().getMenuDisabledForeground()
覆盖法。
MetalTheme
public static ColorUIResource getSeparatorBackground()
getCurrentTheme().getSeparatorBackground()
覆盖法。
MetalTheme
public static ColorUIResource getSeparatorForeground()
getCurrentTheme().getSeparatorForeground()
覆盖法。
MetalTheme
public static ColorUIResource getAcceleratorForeground()
getCurrentTheme().getAcceleratorForeground()
覆盖法。
MetalTheme
public static ColorUIResource getAcceleratorSelectedForeground()
getCurrentTheme().getAcceleratorSelectedForeground()
覆盖法。
MetalTheme
public LayoutStyle getLayoutStyle()
LayoutStyle
外观设计准则规定在
http://www.oracle.com/technetwork/java/hig-136467.html。
getLayoutStyle
方法重写,继承类
LookAndFeel
LayoutStyle.getInstance()
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.