- java.lang.Object
-
- javax.swing.LookAndFeel
-
- javax.swing.plaf.basic.BasicLookAndFeel
-
- javax.swing.plaf.metal.MetalLookAndFeel
-
- All Implemented Interfaces:
-
Serializable
public class MetalLookAndFeel extends BasicLookAndFeel
Java外观和感觉,也称为金属。ComponentUI提供的MetalLookAndFeel每一个从默认表中导出其行为。 除非另有说明,否则此包中的每个ComponentUI实现都会记录它们使用的一组默认值。 除非另有说明默认值是在安装的时候installUI被调用,并按照概述的建议LookAndFeel安装的默认值。MetalLookAndFeel从MetalTheme派生它的调色板和字体。 默认主题是OceanTheme。 可以使用setCurrentTheme方法更改主题,有关更改主题的详细信息,请参阅。 在1.5之前,默认主题是DefaultMetalTheme。 系统属性"swing.metalTheme"可以设置为"steel",表示默认值应为DefaultMetalTheme。警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,支持所有JavaBeans的长期存储已被添加到
java.beans包中。 请参阅XMLEncoder。- 另请参见:
-
MetalTheme,DefaultMetalTheme,OceanTheme, Serialized Form
-
-
构造方法摘要
构造方法 Constructor 描述 MetalLookAndFeel()
-
方法摘要
-
Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel
createAudioAction, getAudioActionMap, initialize, loadSystemColors, playSound, uninitialize
-
Methods inherited from class javax.swing.LookAndFeel
getDesktopPropertyValue, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, toString, uninstallBorder
-
-
-
-
方法详细信息
-
getName
public String getName()
返回这种外观的名称。 这将返回"Metal"。- Specified by:
-
getName在LookAndFeel - 结果
- 这个外观和名感
-
getID
public String getID()
返回此外观的标识符。 这将返回"Metal"。- Specified by:
-
getID在LookAndFeel - 结果
- 这种外观的标识符
-
getDescription
public String getDescription()
返回这种外观的简短描述。 这将返回"The Java(tm) Look and Feel"。- Specified by:
-
getDescription在LookAndFeel - 结果
- 简短的外观和感觉描述
-
isNativeLookAndFeel
public boolean isNativeLookAndFeel()
退货false;MetalLookAndFeel不是原生的外观。- Specified by:
-
isNativeLookAndFeel在LookAndFeel - 结果
-
false
-
isSupportedLookAndFeel
public boolean isSupportedLookAndFeel()
退货true;MetalLookAndFeel可以在任何平台上运行。- Specified by:
-
isSupportedLookAndFeel在LookAndFeel - 结果
-
true - 另请参见:
-
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
-
getSupportsWindowDecorations
public boolean getSupportsWindowDecorations()
退货true; 金属可提供Window装饰。
-
initClassDefaults
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)
-
initSystemColorDefaults
protected void initSystemColorDefaults(UIDefaults table)
用系统颜色填充table。 以下值添加到table: Metal's system color mapping 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)
-
initComponentDefaults
protected void initComponentDefaults(UIDefaults table)
填充table与金属的默认值。- 重写:
-
initComponentDefaults在BasicLookAndFeel - 参数
-
table- 要添加值的UIDefaults - 异常
-
NullPointerException- 如果table是null
-
createDefaultTheme
protected void createDefaultTheme()
确保目前的MetalTheme是non-null。 这是一个getCurrentTheme的封面方法。- 另请参见:
-
getCurrentTheme()
-
getDefaults
public UIDefaults getDefaults()
返回外观和默认值。 这createDefaultTheme()顺序调用super.getDefaults()和getCurrentTheme().addCustomEntriesToTable(table)。虽然这种方法是公开的,但是当外观和感觉被设置为当前的外观并且在调用
initialize之后,它应该仅由UIManager调用。
-
provideErrorFeedback
public void provideErrorFeedback(Component component)
当用户尝试无效操作时调用,例如粘贴到具有焦点的不可编辑的JTextField中。 默认实现哔声。 希望不同行为的子类应该覆盖此,并提供其他反馈。- 重写:
-
provideErrorFeedback在LookAndFeel - 参数
-
component-Component发生错误,可能是null表示错误状况与Component没有直接关联 - 从以下版本开始:
- 1.4
-
setCurrentTheme
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()
-
getCurrentTheme
public static MetalTheme getCurrentTheme()
返回MetalLookAndFeel当前正在使用的主题。 如果当前主题是null,则会创建默认主题。- 结果
- 当前的主题
- 从以下版本开始:
- 1.5
- 另请参见:
-
setCurrentTheme(javax.swing.plaf.metal.MetalTheme)
-
getDisabledIcon
public Icon getDisabledIcon(JComponent component, Icon icon)
返回Icon,具有禁用的外观。 当没有指定的时候,该方法用于生成一个禁用的Icon。 例如,如果您创建一个JButton并且仅通过setIcon指定了一个Icon,setIcon此方法来生成禁用的Icon。 如果null作为icon传递,icon此方法返回null。有些看起来和感觉可能不会渲染残疾人图标,在这种情况下,他们将忽略这一点。
- 重写:
-
getDisabledIcon在LookAndFeel - 参数
-
component- 将显示图标的JComponent可能为null -
icon- 图标来生成禁用图标。 - 结果
- 禁用图标,如果无法生成合适的图标,则为null。
- 从以下版本开始:
- 1.5
-
getDisabledSelectedIcon
public Icon getDisabledSelectedIcon(JComponent component, Icon icon)
返回一个Icon用于还被选中的禁用组件使用。 此方法用于为禁用和选定状态的组件生成Icon,但对于该状态不具有特定的Icon。 例如,如果您创建了一个JButton并且仅通过setIcon指定了一个Icon,setIcon此方法来生成禁用和选择的Icon。 如果null作为icon传递,icon此方法返回null。一些外观和感觉可能不会渲染残疾人和选定的图标,在这种情况下,他们将忽略这一点。
- 重写:
-
getDisabledSelectedIcon在LookAndFeel - 参数
-
component- 将显示图标的JComponent可能为null -
icon- 生成禁用和选定图标的图标。 - 结果
- 已禁用和已选择图标,如果无法生成合适的图标,则为null。
- 从以下版本开始:
- 1.5
-
getControlTextFont
public static FontUIResource getControlTextFont()
返回当前主题的控件文本字体。 这是一个getCurrentTheme().getControlTextColor()的封面方法。- 结果
- 控件文字字体
- 另请参见:
-
MetalTheme
-
getSystemTextFont
public static FontUIResource getSystemTextFont()
返回当前主题的系统文本字体。 这是一个getCurrentTheme().getSystemTextFont()的封面方法。- 结果
- 系统文字字体
- 另请参见:
-
MetalTheme
-
getUserTextFont
public static FontUIResource getUserTextFont()
返回当前主题的用户文本字体。 这是一个getCurrentTheme().getUserTextFont()的封面方法。- 结果
- 用户文字字体
- 另请参见:
-
MetalTheme
-
getMenuTextFont
public static FontUIResource getMenuTextFont()
返回当前主题的菜单文本字体。 这是一个getCurrentTheme().getMenuTextFont()的封面方法。- 结果
- 菜单文字字体
- 另请参见:
-
MetalTheme
-
getWindowTitleFont
public static FontUIResource getWindowTitleFont()
返回当前主题的窗口标题字体。 这是一个getCurrentTheme().getWindowTitleFont()的封面方法。- 结果
- 窗口标题字体
- 另请参见:
-
MetalTheme
-
getSubTextFont
public static FontUIResource getSubTextFont()
返回当前主题的子文本字体。 这是一个getCurrentTheme().getSubTextFont()的封面方法。- 结果
- 子文字字体
- 另请参见:
-
MetalTheme
-
getDesktopColor
public static ColorUIResource getDesktopColor()
返回当前主题的桌面颜色。 这是一个getCurrentTheme().getDesktopColor()的封面方法。- 结果
- 桌面颜色
- 另请参见:
-
MetalTheme
-
getFocusColor
public static ColorUIResource getFocusColor()
返回当前主题的焦点颜色。 这是一个getCurrentTheme().getFocusColor()的封面方法。- 结果
- 焦点颜色
- 另请参见:
-
MetalTheme
-
getWhite
public static ColorUIResource getWhite()
返回当前主题的白色。 这是一个getCurrentTheme().getWhite()的封面方法。- 结果
- 白色
- 另请参见:
-
MetalTheme
-
getBlack
public static ColorUIResource getBlack()
返回当前主题的黑色。 这是一个getCurrentTheme().getBlack()的封面方法。- 结果
- 黑色
- 另请参见:
-
MetalTheme
-
getControl
public static ColorUIResource getControl()
返回当前主题的控件颜色。 这是一个getCurrentTheme().getControl()的封面方法。- 结果
- 控制颜色
- 另请参见:
-
MetalTheme
-
getControlShadow
public static ColorUIResource getControlShadow()
返回当前主题的控件阴影颜色。 这是一个getCurrentTheme().getControlShadow()的封面方法。- 结果
- 控制阴影颜色
- 另请参见:
-
MetalTheme
-
getControlDarkShadow
public static ColorUIResource getControlDarkShadow()
返回当前主题的控件阴影颜色。 这是一个getCurrentTheme().getControlDarkShadow()的封面方法。- 结果
- 控制暗影色
- 另请参见:
-
MetalTheme
-
getControlInfo
public static ColorUIResource getControlInfo()
返回当前主题的控件信息颜色。 这是一个getCurrentTheme().getControlInfo()的封面方法。- 结果
- 控制信息颜色
- 另请参见:
-
MetalTheme
-
getControlHighlight
public static ColorUIResource getControlHighlight()
返回当前主题的控件突出显示颜色。 这是一个getCurrentTheme().getControlHighlight()的封面方法。- 结果
- 控制高亮颜色
- 另请参见:
-
MetalTheme
-
getControlDisabled
public static ColorUIResource getControlDisabled()
返回当前主题的控件禁用颜色。 这是一个getCurrentTheme().getControlDisabled()的封面方法。- 结果
- 控制禁止颜色
- 另请参见:
-
MetalTheme
-
getPrimaryControl
public static ColorUIResource getPrimaryControl()
返回当前主题的主控制颜色。 这是一个getCurrentTheme().getPrimaryControl()的封面方法。- 结果
- 主要控制颜色
- 另请参见:
-
MetalTheme
-
getPrimaryControlShadow
public static ColorUIResource getPrimaryControlShadow()
返回当前主题的主控制阴影颜色。 这是一个getCurrentTheme().getPrimaryControlShadow()的封面方法。- 结果
- 主要控制阴影颜色
- 另请参见:
-
MetalTheme
-
getPrimaryControlDarkShadow
public static ColorUIResource getPrimaryControlDarkShadow()
返回当前主题的主控制阴影颜色。 这是一个getCurrentTheme().getPrimaryControlDarkShadow()的封面方法。- 结果
- 主要控制暗影色彩
- 另请参见:
-
MetalTheme
-
getPrimaryControlInfo
public static ColorUIResource getPrimaryControlInfo()
返回当前主题的主控制信息颜色。 这是一个getCurrentTheme().getPrimaryControlInfo()的封面方法。- 结果
- 主要控制信息颜色
- 另请参见:
-
MetalTheme
-
getPrimaryControlHighlight
public static ColorUIResource getPrimaryControlHighlight()
返回当前主题的主控制突出显示颜色。 这是一个getCurrentTheme().getPrimaryControlHighlight()的封面方法。- 结果
- 主要控件突出显示颜色
- 另请参见:
-
MetalTheme
-
getSystemTextColor
public static ColorUIResource getSystemTextColor()
返回当前主题的系统文本颜色。 这是一个getCurrentTheme().getSystemTextColor()的封面方法。- 结果
- 系统文字颜色
- 另请参见:
-
MetalTheme
-
getControlTextColor
public static ColorUIResource getControlTextColor()
返回当前主题的控件文本颜色。 这是一个getCurrentTheme().getControlTextColor()的封面方法。- 结果
- 控件文字颜色
- 另请参见:
-
MetalTheme
-
getInactiveControlTextColor
public static ColorUIResource getInactiveControlTextColor()
返回当前主题的非活动控件文本颜色。 这是一个getCurrentTheme().getInactiveControlTextColor()的封面方法。- 结果
- 非活动控件文本颜色
- 另请参见:
-
MetalTheme
-
getInactiveSystemTextColor
public static ColorUIResource getInactiveSystemTextColor()
返回当前主题的非活动系统文本颜色。 这是一个getCurrentTheme().getInactiveSystemTextColor()的封面方法。- 结果
- 非活动的系统文本颜色
- 另请参见:
-
MetalTheme
-
getUserTextColor
public static ColorUIResource getUserTextColor()
返回当前主题的用户文本颜色。 这是一个getCurrentTheme().getUserTextColor()的封面方法。- 结果
- 用户文字颜色
- 另请参见:
-
MetalTheme
-
getTextHighlightColor
public static ColorUIResource getTextHighlightColor()
返回当前主题的文本突出显示颜色。 这是一个getCurrentTheme().getTextHighlightColor()的封面方法。- 结果
- 文字突出显示颜色
- 另请参见:
-
MetalTheme
-
getHighlightedTextColor
public static ColorUIResource getHighlightedTextColor()
返回当前主题的突出显示的文本颜色。 这是一个getCurrentTheme().getHighlightedTextColor()的封面方法。- 结果
- 突出显示的文字颜色
- 另请参见:
-
MetalTheme
-
getWindowBackground
public static ColorUIResource getWindowBackground()
返回当前主题的窗口背景颜色。 这是一个getCurrentTheme().getWindowBackground()的封面方法。- 结果
- 窗口背景颜色
- 另请参见:
-
MetalTheme
-
getWindowTitleBackground
public static ColorUIResource getWindowTitleBackground()
返回当前主题的窗口标题背景颜色。 这是一个getCurrentTheme().getWindowTitleBackground()的封面方法。- 结果
- 窗口标题背景颜色
- 另请参见:
-
MetalTheme
-
getWindowTitleForeground
public static ColorUIResource getWindowTitleForeground()
返回当前主题的窗口标题前景色。 这是一个getCurrentTheme().getWindowTitleForeground()的封面方法。- 结果
- 窗口标题前景色
- 另请参见:
-
MetalTheme
-
getWindowTitleInactiveBackground
public static ColorUIResource getWindowTitleInactiveBackground()
返回当前主题的窗口标题无效背景颜色。 这是一个getCurrentTheme().getWindowTitleInactiveBackground()的封面方法。- 结果
- 窗口标题无效背景颜色
- 另请参见:
-
MetalTheme
-
getWindowTitleInactiveForeground
public static ColorUIResource getWindowTitleInactiveForeground()
返回当前主题的窗口标题无效的前景色。 这是一个getCurrentTheme().getWindowTitleInactiveForeground()的封面方法。- 结果
- 窗口标题无效的前景色
- 另请参见:
-
MetalTheme
-
getMenuBackground
public static ColorUIResource getMenuBackground()
返回当前主题的菜单背景颜色。 这是一个getCurrentTheme().getMenuBackground()的封面方法。- 结果
- 菜单背景颜色
- 另请参见:
-
MetalTheme
-
getMenuForeground
public static ColorUIResource getMenuForeground()
返回当前主题的菜单前景色。 这是一个getCurrentTheme().getMenuForeground()的封面方法。- 结果
- 菜单前景色
- 另请参见:
-
MetalTheme
-
getMenuSelectedBackground
public static ColorUIResource getMenuSelectedBackground()
返回当前主题的菜单选择的背景颜色。 这是一个getCurrentTheme().getMenuSelectedBackground()的封面方法。- 结果
- 菜单选择背景颜色
- 另请参见:
-
MetalTheme
-
getMenuSelectedForeground
public static ColorUIResource getMenuSelectedForeground()
返回菜单选择当前主题的前景色。 这是一个getCurrentTheme().getMenuSelectedForeground()的封面方法。- 结果
- 菜单选择前景色
- 另请参见:
-
MetalTheme
-
getMenuDisabledForeground
public static ColorUIResource getMenuDisabledForeground()
返回菜单禁用的当前主题的前景色。 这是一个getCurrentTheme().getMenuDisabledForeground()的封面方法。- 结果
- 菜单禁用前景色
- 另请参见:
-
MetalTheme
-
getSeparatorBackground
public static ColorUIResource getSeparatorBackground()
返回当前主题的分隔符背景颜色。 这是一个getCurrentTheme().getSeparatorBackground()的封面方法。- 结果
- 分离器背景颜色
- 另请参见:
-
MetalTheme
-
getSeparatorForeground
public static ColorUIResource getSeparatorForeground()
返回当前主题的分隔符前景颜色。 这是一个getCurrentTheme().getSeparatorForeground()的封面方法。- 结果
- 分离器前景色
- 另请参见:
-
MetalTheme
-
getAcceleratorForeground
public static ColorUIResource getAcceleratorForeground()
返回当前主题的加速器前景色。 这是一个getCurrentTheme().getAcceleratorForeground()的封面方法。- 结果
- 分离器加速器前景色
- 另请参见:
-
MetalTheme
-
getAcceleratorSelectedForeground
public static ColorUIResource getAcceleratorSelectedForeground()
返回加速器选择的当前主题的前景色。 这是一个getCurrentTheme().getAcceleratorSelectedForeground()的封面方法。- 结果
- 加速器选择前景色
- 另请参见:
-
MetalTheme
-
getLayoutStyle
public LayoutStyle getLayoutStyle()
返回LayoutStyle实现Java外观和作为指定觉得设计指南 http://www.oracle.com/technetwork/java/hig-136467.html 。- 重写:
-
getLayoutStyle在LookAndFeel - 结果
- LayoutStyle实现Java外观设计指南
- 从以下版本开始:
- 1.6
- 另请参见:
-
LayoutStyle.getInstance()
-
-