public class MetalLookAndFeel extends BasicLookAndFeel
ComponentUI提供的MetalLookAndFeel都从默认表中导出其行为。 除非另有说明,否则此程序包中的每个ComponentUI都会记录它们使用的一组默认值。 除非另有说明,否则默认值将在installUI被调用时安装,并按照LookAndFeel中概述的LookAndFeel安装默认值。
MetalLookAndFeel派生它的调色板和字体MetalTheme 。 默认主题是OceanTheme 。 主题可以使用setCurrentTheme方法更改,有关更改主题的详细信息,请参阅。 在1.5之前,默认主题是DefaultMetalTheme 。 系统属性"swing.metalTheme"可以设置为"steel" ,表示默认值应为DefaultMetalTheme 。
警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,对所有JavaBeans的长期存储的支持已经添加到java.beans包中。 请参阅XMLEncoder 。
MetalTheme , DefaultMetalTheme , OceanTheme
| Constructor and Description |
|---|
MetalLookAndFeel() |
createAudioAction, getAudioActionMap, initialize, loadSystemColors, playSound, uninitializegetDesktopPropertyValue, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, toString, uninstallBorderpublic 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装饰。
protected void initClassDefaults(UIDefaults table)
table从映射uiClassID到ui类的完全限定名。
MetalLookAndFeel为名为MetalXXXUI的包javax.swing.plaf.metal中的每个类注册一个条目。
字符串XXX是Swing的uiClassID之一。
对于uiClassIDs不具有在金属类,在对应的类javax.swing.plaf.basic被使用。
例如,金属没有名为"MetalColorChooserUI"的类, javax.swing.plaf.basic.BasicColorChooserUI使用javax.swing.plaf.basic.BasicColorChooserUI 。
initClassDefaults在
BasicLookAndFeel
table - 添加条目的
UIDefaults实例
NullPointerException - 如果
table是
null
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对象
NullPointerException - 如果
table是
null
SystemColor , BasicLookAndFeel.getDefaults() , BasicLookAndFeel.loadSystemColors(javax.swing.UIDefaults, java.lang.String[], boolean)
protected void initComponentDefaults(UIDefaults table)
table与金属的默认值。
initComponentDefaults在
BasicLookAndFeel
table - 要添加值的
UIDefaults
NullPointerException - 如果
table是
null
protected void createDefaultTheme()
MetalTheme是non-null 。
这是getCurrentTheme的封面方法。
getCurrentTheme()
public UIDefaults getDefaults()
createDefaultTheme() , super.getDefaults()和getCurrentTheme().addCustomEntriesToTable(table) 。
尽管此方法是公共的,但只能由调用UIManager当外观被设置为当前的外观和后initialize已被调用。
public void provideErrorFeedback(Component component)
JTextField 。
默认实现哔声。
希望不同行为的子类应该覆盖此,并提供其他反馈。
provideErrorFeedback在
LookAndFeel
component -
Component发生错误,可能是
null表示错误状况与
Component没有直接
Component
public static void setCurrentTheme(MetalTheme theme)
MetalLookAndFeel使用的主题。
主题确定后, MetalLookAndFeel需要重新安装和研究所需要重新创建。 以下显示如何做到这一点:
MetalLookAndFeel.setCurrentTheme(theme);
// re-install the Metal Look and Feel
UIManager.setLookAndFeel(new MetalLookAndFeel());
// Update the ComponentUIs for all Components. This
// needs to be invoked for all windows.
SwingUtilities.updateComponentTreeUI(rootComponent);
如果没有这样做,结果是未定义的。
theme - 使用的主题
NullPointerException - 如果
theme是
null
getCurrentTheme()
public static MetalTheme getCurrentTheme()
MetalLookAndFeel 。
如果当前主题是null ,则创建默认主题。
setCurrentTheme(javax.swing.plaf.metal.MetalTheme)
public Icon getDisabledIcon(JComponent component, Icon icon)
Icon具有禁用外观。
这种方法被用于产生一个禁用Icon时,未指定的一个。
例如,如果您创建了一个JButton并且仅通过setIcon指定了一个Icon , setIcon此方法来生成禁用的Icon 。
如果null作为icon传递, icon此方法返回null。
有些看起来和感觉可能不会渲染残疾人图标,在这种情况下,他们将忽略这一点。
getDisabledIcon在类
LookAndFeel
component - 将显示图标的JComponent可能为null
icon -
icon生成禁用图标的图标。
public Icon getDisabledSelectedIcon(JComponent component, Icon icon)
Icon用于还被选中的禁用组件使用。
该方法用于为禁用和选定状态的Icon生成Icon,但对于该状态不具有特定的Icon 。
例如,如果您创建了一个JButton ,并且仅通过setIcon指定了一个Icon , setIcon此方法来生成禁用和选择的Icon 。
如果null作为icon传递, icon此方法返回null。
一些外观和感觉可能不会渲染残疾人和选定的图标,在这种情况下,他们将忽略这一点。
getDisabledSelectedIcon在
LookAndFeel
component - 将显示图标的JComponent可能为null
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规定的Java外观设计指南的
LayoutStyle 。
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.