- java.lang.Object
-
- javax.swing.LookAndFeel
-
- javax.swing.plaf.basic.BasicLookAndFeel
-
- javax.swing.plaf.metal.MetalLookAndFeel
-
- 实现的所有接口
-
Serializable
public class MetalLookAndFeel extends BasicLookAndFeel
Java Look and Feel,也称为Metal。每个的
ComponentUI的前提是SMetalLookAndFeel派生默认表其行为。 除非另有说明,否则此包中的每个ComponentUI实现都会记录它们使用的默认值集。 除非另有说明默认值是在安装的时候installUI被调用,并按照概述的建议LookAndFeel安装的默认值。MetalLookAndFeel从MetalTheme派生出它的调色板和字体。 默认主题是OceanTheme。 可以使用setCurrentTheme方法更改主题,有关更改主题的详细信息,请参阅它。 在1.5之前,默认主题是DefaultMetalTheme。 系统属性"swing.metalTheme"可以设置为"steel"以指示默认值应为DefaultMetalTheme。警告:此类的序列化对象与以后的Swing版本不兼容。 当前的序列化支持适用于运行相同版本Swing的应用程序之间的短期存储或RMI。 从1.4开始,
java.beans软件包中添加了对所有JavaBeansjava.beans长期存储的支持。 请参阅XMLEncoder。- 另请参见:
-
MetalTheme,DefaultMetalTheme,OceanTheme, Serialized Form
-
-
构造方法摘要
构造方法 构造器 描述 MetalLookAndFeel()
-
方法摘要
-
声明方法的类 javax.swing.plaf.basic.BasicLookAndFeel
createAudioAction, getAudioActionMap, loadSystemColors, playSound
-
-
-
-
方法详细信息
-
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)
使用从uiClassID到ui类的完全限定名称的映射填充table。MetalLookAndFeel登记在包为每个类的条目javax.swing.plaf.metal被命名MetalXXXUI。 字符串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需要重新创建uis。 以下显示了如何执行此操作: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。某些外观可能无法呈现禁用的Icon,在这种情况下,它们会忽略它。
- 重写:
-
getDisabledIcon在类LookAndFeel - 参数
-
component- 将显示Icon的JComponent可能为null -
icon- 从中生成禁用图标的图标。 - 结果
- 已禁用图标,如果无法生成合适的图标,则为null。
- 从以下版本开始:
- 1.5
-
getDisabledSelectedIcon
public Icon getDisabledSelectedIcon(JComponent component, Icon icon)
返回Icon以供同时选中的已禁用组件使用。 此方法用于为处于禁用状态和选定状态但但没有针对此状态的特定Icon组件生成Icon。 例如,如果创建JButton并仅通过setIcon指定Icon,setIcon此方法以生成禁用并选择Icon。 如果null传递为icon此方法返回null。一些外观可能无法呈现禁用和选择的图标,在这种情况下,他们将忽略这一点。
- 重写:
-
getDisabledSelectedIcon,类LookAndFeel - 参数
-
component- 将显示Icon的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实现 http://www.oracle.com/technetwork/java/hig-136467.html中指定的Java外观设计指南。- 重写:
-
getLayoutStyle在课程LookAndFeel - 结果
- LayoutStyle实现Java外观设计指南
- 从以下版本开始:
- 1.6
- 另请参见:
-
LayoutStyle.getInstance()
-
-