- 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.BasicLookAndFeelcreateAudioAction, getAudioActionMap, loadSystemColors, playSound
 
-  
               
 
-  
             
-  
        
       -  
             方法详细信息-  getNamepublic String getName() 返回此外观的名称。 返回"Metal"。- Specified by:
-  
              getName在类LookAndFeel
- 结果
- 这种外观和感觉的名称
 
 -  getIDpublic String getID() 返回此外观的标识符。 返回"Metal"。- Specified by:
-  
              getID在课堂上LookAndFeel
- 结果
- 这种外观的标识符
 
 -  getDescriptionpublic String getDescription() 返回此外观的简短描述。 返回"The Java(tm) Look and Feel"。- Specified by:
-  
              getDescription在课堂上LookAndFeel
- 结果
- 外观和感觉的简短描述
 
 -  isNativeLookAndFeelpublic boolean isNativeLookAndFeel() 返回false;MetalLookAndFeel不是原生的外观和感觉。- Specified by:
-  
              isNativeLookAndFeel,类LookAndFeel
- 结果
-  
              false
 
 -  isSupportedLookAndFeelpublic boolean isSupportedLookAndFeel() 返回true;MetalLookAndFeel可以在任何平台上运行。- Specified by:
-  
              isSupportedLookAndFeel,类LookAndFeel
- 结果
-  
              true
- 另请参见:
-  
              UIManager.setLookAndFeel(javax.swing.LookAndFeel)
 
 -  getSupportsWindowDecorationspublic boolean getSupportsWindowDecorations() 返回true; 金属可以提供Window装饰品。
 -  initClassDefaultsprotected 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)
 
 -  initSystemColorDefaultsprotected 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)
 
 -  initComponentDefaultsprotected void initComponentDefaults(UIDefaults table) 使用金属的默认值填充table。- 重写:
-  
              initComponentDefaults,类BasicLookAndFeel
- 参数
-  
              table- 要添加值的UIDefaults
- 异常
-  
              NullPointerException- 如果table是null
 
 -  createDefaultThemeprotected void createDefaultTheme() 确保当前MetalTheme是non-null。 这是getCurrentTheme的封面方法。- 另请参见:
-  
              getCurrentTheme()
 
 -  getDefaultspublic UIDefaults getDefaults() 返回外观默认值。 这createDefaultTheme()顺序调用super.getDefaults()和getCurrentTheme().addCustomEntriesToTable(table)。虽然此方法是公共的,但只有当外观设置为当前外观并且在调用 initialize之后,才应该由UIManager调用它。
 -  provideErrorFeedbackpublic void provideErrorFeedback(Component component) 当用户尝试无效操作时调用,例如粘贴到具有焦点的不可编辑的JTextField。 默认实现发出哔哔声。 希望采用不同行为的子类应覆盖此类并提供其他反馈。- 重写:
-  
              provideErrorFeedback在LookAndFeel类
- 参数
-  
              component- 发生错误Component,可能是null表示错误情况与Component没有直接关联
- 从以下版本开始:
- 1.4
 
 -  setCurrentThemepublic 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()
 
 -  getCurrentThemepublic static MetalTheme getCurrentTheme() 返回MetalLookAndFeel当前使用的主题。 如果当前主题是null,则创建默认主题。- 结果
- 目前的主题
- 从以下版本开始:
- 1.5
- 另请参见:
-  
              setCurrentTheme(javax.swing.plaf.metal.MetalTheme)
 
 -  getDisabledIconpublic 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
 
 -  getDisabledSelectedIconpublic 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
 
 -  getControlTextFontpublic static FontUIResource getControlTextFont() 返回当前主题的控件文本字体。 这是getCurrentTheme().getControlTextColor()的封面方法。- 结果
- 控制文本字体
- 另请参见:
-  
              MetalTheme
 
 -  getSystemTextFontpublic static FontUIResource getSystemTextFont() 返回当前主题的系统文本字体。 这是getCurrentTheme().getSystemTextFont()的封面方法。- 结果
- 系统文本字体
- 另请参见:
-  
              MetalTheme
 
 -  getUserTextFontpublic static FontUIResource getUserTextFont() 返回当前主题的用户文本字体。 这是getCurrentTheme().getUserTextFont()的封面方法。- 结果
- 用户文字字体
- 另请参见:
-  
              MetalTheme
 
 -  getMenuTextFontpublic static FontUIResource getMenuTextFont() 返回当前主题的菜单文本字体。 这是getCurrentTheme().getMenuTextFont()的封面方法。- 结果
- 菜单文字字体
- 另请参见:
-  
              MetalTheme
 
 -  getWindowTitleFontpublic static FontUIResource getWindowTitleFont() 返回当前主题的窗口标题字体。 这是getCurrentTheme().getWindowTitleFont()的封面方法。- 结果
- 窗口标题字体
- 另请参见:
-  
              MetalTheme
 
 -  getSubTextFontpublic static FontUIResource getSubTextFont() 返回当前主题的子文本字体。 这是getCurrentTheme().getSubTextFont()的封面方法。- 结果
- 子文本字体
- 另请参见:
-  
              MetalTheme
 
 -  getDesktopColorpublic static ColorUIResource getDesktopColor() 返回当前主题的桌面颜色。 这是getCurrentTheme().getDesktopColor()的封面方法。- 结果
- 桌面颜色
- 另请参见:
-  
              MetalTheme
 
 -  getFocusColorpublic static ColorUIResource getFocusColor() 返回当前主题的焦点颜色。 这是getCurrentTheme().getFocusColor()的封面方法。- 结果
- 焦点颜色
- 另请参见:
-  
              MetalTheme
 
 -  getWhitepublic static ColorUIResource getWhite() 返回当前主题的白色。 这是getCurrentTheme().getWhite()的封面方法。- 结果
- 白色
- 另请参见:
-  
              MetalTheme
 
 -  getBlackpublic static ColorUIResource getBlack() 返回当前主题的黑色。 这是getCurrentTheme().getBlack()的封面方法。- 结果
- 黑色
- 另请参见:
-  
              MetalTheme
 
 -  getControlpublic static ColorUIResource getControl() 返回当前主题的控件颜色。 这是getCurrentTheme().getControl()的封面方法。- 结果
- 控制颜色
- 另请参见:
-  
              MetalTheme
 
 -  getControlShadowpublic static ColorUIResource getControlShadow() 返回当前主题的控件阴影颜色。 这是getCurrentTheme().getControlShadow()的封面方法。- 结果
- 控制阴影颜色
- 另请参见:
-  
              MetalTheme
 
 -  getControlDarkShadowpublic static ColorUIResource getControlDarkShadow() 返回当前主题的控件暗阴影颜色。 这是getCurrentTheme().getControlDarkShadow()的封面方法。- 结果
- 控制暗阴影颜色
- 另请参见:
-  
              MetalTheme
 
 -  getControlInfopublic static ColorUIResource getControlInfo() 返回当前主题的控件信息颜色。 这是getCurrentTheme().getControlInfo()的封面方法。- 结果
- 控制信息颜色
- 另请参见:
-  
              MetalTheme
 
 -  getControlHighlightpublic static ColorUIResource getControlHighlight() 返回当前主题的控件突出显示颜色。 这是getCurrentTheme().getControlHighlight()的封面方法。- 结果
- 控件突出显示颜色
- 另请参见:
-  
              MetalTheme
 
 -  getControlDisabledpublic static ColorUIResource getControlDisabled() 返回当前主题的控件禁用颜色。 这是getCurrentTheme().getControlDisabled()的封面方法。- 结果
- 控件禁用颜色
- 另请参见:
-  
              MetalTheme
 
 -  getPrimaryControlpublic static ColorUIResource getPrimaryControl() 返回当前主题的主要控件颜色。 这是getCurrentTheme().getPrimaryControl()的封面方法。- 结果
- 主要控制颜色
- 另请参见:
-  
              MetalTheme
 
 -  getPrimaryControlShadowpublic static ColorUIResource getPrimaryControlShadow() 返回当前主题的主要控件阴影颜色。 这是getCurrentTheme().getPrimaryControlShadow()的封面方法。- 结果
- 主要控制阴影颜色
- 另请参见:
-  
              MetalTheme
 
 -  getPrimaryControlDarkShadowpublic static ColorUIResource getPrimaryControlDarkShadow() 返回当前主题的主要控件暗阴影颜色。 这是getCurrentTheme().getPrimaryControlDarkShadow()的封面方法。- 结果
- 主要控制暗影颜色
- 另请参见:
-  
              MetalTheme
 
 -  getPrimaryControlInfopublic static ColorUIResource getPrimaryControlInfo() 返回当前主题的主要控件信息颜色。 这是getCurrentTheme().getPrimaryControlInfo()的封面方法。- 结果
- 主要控制信息颜色
- 另请参见:
-  
              MetalTheme
 
 -  getPrimaryControlHighlightpublic static ColorUIResource getPrimaryControlHighlight() 返回当前主题的主要控件突出显示颜色。 这是getCurrentTheme().getPrimaryControlHighlight()的封面方法。- 结果
- 主要控制突出显示颜色
- 另请参见:
-  
              MetalTheme
 
 -  getSystemTextColorpublic static ColorUIResource getSystemTextColor() 返回当前主题的系统文本颜色。 这是getCurrentTheme().getSystemTextColor()的封面方法。- 结果
- 系统文字颜色
- 另请参见:
-  
              MetalTheme
 
 -  getControlTextColorpublic static ColorUIResource getControlTextColor() 返回当前主题的控件文本颜色。 这是getCurrentTheme().getControlTextColor()的封面方法。- 结果
- 控制文字颜色
- 另请参见:
-  
              MetalTheme
 
 -  getInactiveControlTextColorpublic static ColorUIResource getInactiveControlTextColor() 返回当前主题的非活动控件文本颜色。 这是getCurrentTheme().getInactiveControlTextColor()的封面方法。- 结果
- 非活动控件文本颜色
- 另请参见:
-  
              MetalTheme
 
 -  getInactiveSystemTextColorpublic static ColorUIResource getInactiveSystemTextColor() 返回当前主题的非活动系统文本颜色。 这是getCurrentTheme().getInactiveSystemTextColor()的封面方法。- 结果
- 不活动的系统文本颜色
- 另请参见:
-  
              MetalTheme
 
 -  getUserTextColorpublic static ColorUIResource getUserTextColor() 返回当前主题的用户文本颜色。 这是getCurrentTheme().getUserTextColor()的封面方法。- 结果
- 用户文字颜色
- 另请参见:
-  
              MetalTheme
 
 -  getTextHighlightColorpublic static ColorUIResource getTextHighlightColor() 返回当前主题的文本突出显示颜色。 这是getCurrentTheme().getTextHighlightColor()的封面方法。- 结果
- 文字突出显示颜色
- 另请参见:
-  
              MetalTheme
 
 -  getHighlightedTextColorpublic static ColorUIResource getHighlightedTextColor() 返回当前主题的突出显示的文本颜色。 这是getCurrentTheme().getHighlightedTextColor()的封面方法。- 结果
- 突出显示的文字颜色
- 另请参见:
-  
              MetalTheme
 
 -  getWindowBackgroundpublic static ColorUIResource getWindowBackground() 返回当前主题的窗口背景颜色。 这是getCurrentTheme().getWindowBackground()的封面方法。- 结果
- 窗口背景颜色
- 另请参见:
-  
              MetalTheme
 
 -  getWindowTitleBackgroundpublic static ColorUIResource getWindowTitleBackground() 返回当前主题的窗口标题背景颜色。 这是getCurrentTheme().getWindowTitleBackground()的封面方法。- 结果
- 窗口标题背景颜色
- 另请参见:
-  
              MetalTheme
 
 -  getWindowTitleForegroundpublic static ColorUIResource getWindowTitleForeground() 返回当前主题的窗口标题前景色。 这是getCurrentTheme().getWindowTitleForeground()的封面方法。- 结果
- 窗口标题前景色
- 另请参见:
-  
              MetalTheme
 
 -  getWindowTitleInactiveBackgroundpublic static ColorUIResource getWindowTitleInactiveBackground() 返回当前主题的窗口标题非活动背景颜色。 这是getCurrentTheme().getWindowTitleInactiveBackground()的封面方法。- 结果
- 窗口标题不活动的背景颜色
- 另请参见:
-  
              MetalTheme
 
 -  getWindowTitleInactiveForegroundpublic static ColorUIResource getWindowTitleInactiveForeground() 返回当前主题的窗口标题非活动前景色。 这是getCurrentTheme().getWindowTitleInactiveForeground()的封面方法。- 结果
- 窗口标题不活动的前景色
- 另请参见:
-  
              MetalTheme
 
 -  getMenuBackgroundpublic static ColorUIResource getMenuBackground() 返回当前主题的菜单背景颜色。 这是getCurrentTheme().getMenuBackground()的封面方法。- 结果
- 菜单背景颜色
- 另请参见:
-  
              MetalTheme
 
 -  getMenuForegroundpublic static ColorUIResource getMenuForeground() 返回当前主题的菜单前景色。 这是getCurrentTheme().getMenuForeground()的封面方法。- 结果
- 菜单前景色
- 另请参见:
-  
              MetalTheme
 
 -  getMenuSelectedBackgroundpublic static ColorUIResource getMenuSelectedBackground() 返回当前主题的菜单选定背景颜色。 这是getCurrentTheme().getMenuSelectedBackground()的封面方法。- 结果
- 菜单选择了背景颜色
- 另请参见:
-  
              MetalTheme
 
 -  getMenuSelectedForegroundpublic static ColorUIResource getMenuSelectedForeground() 返回当前主题的菜单选定前景色。 这是getCurrentTheme().getMenuSelectedForeground()的封面方法。- 结果
- 菜单选择了前景色
- 另请参见:
-  
              MetalTheme
 
 -  getMenuDisabledForegroundpublic static ColorUIResource getMenuDisabledForeground() 返回当前主题的菜单禁用前景色。 这是getCurrentTheme().getMenuDisabledForeground()的封面方法。- 结果
- 菜单禁用前景色
- 另请参见:
-  
              MetalTheme
 
 -  getSeparatorBackgroundpublic static ColorUIResource getSeparatorBackground() 返回当前主题的分隔符背景颜色。 这是getCurrentTheme().getSeparatorBackground()的封面方法。- 结果
- 分隔符背景颜色
- 另请参见:
-  
              MetalTheme
 
 -  getSeparatorForegroundpublic static ColorUIResource getSeparatorForeground() 返回当前主题的分隔符前景色。 这是getCurrentTheme().getSeparatorForeground()的封面方法。- 结果
- 分隔符前景色
- 另请参见:
-  
              MetalTheme
 
 -  getAcceleratorForegroundpublic static ColorUIResource getAcceleratorForeground() 返回当前主题的加速器前景色。 这是getCurrentTheme().getAcceleratorForeground()的封面方法。- 结果
- 分隔符加速器前景色
- 另请参见:
-  
              MetalTheme
 
 -  getAcceleratorSelectedForegroundpublic static ColorUIResource getAcceleratorSelectedForeground() 返回当前主题的加速器选定前景色。 这是getCurrentTheme().getAcceleratorSelectedForeground()的封面方法。- 结果
- 加速器选择了前景色
- 另请参见:
-  
              MetalTheme
 
 -  getLayoutStylepublic LayoutStyle getLayoutStyle() 返回LayoutStyle实现 http://www.oracle.com/technetwork/java/hig-136467.html中指定的Java外观设计指南。- 重写:
-  
              getLayoutStyle在课程LookAndFeel
- 结果
- LayoutStyle实现Java外观设计指南
- 从以下版本开始:
- 1.6
- 另请参见:
-  
              LayoutStyle.getInstance()
 
 
-  
 
-