JavaTM 2 Platform
Standard Ed. 6

javax.swing.plaf.metal
类 DefaultMetalTheme

java.lang.Object
  继承者 javax.swing.plaf.metal.MetalTheme
      继承者 javax.swing.plaf.metal.DefaultMetalTheme
直接已知子类:
OceanTheme

public class DefaultMetalTheme
extends MetalTheme

提供 Java 外观原型的 MetalTheme 的一个具体实现,代码名称为“Steel”。有关更改默认主题的详细信息,请参阅 MetalLookAndFeel.setCurrentTheme(javax.swing.plaf.metal.MetalTheme)

DefaultMetalTheme 返回的所有颜色都是完全不透明的。

字体样式

DefaultMetalTheme 对许多控件使用黑体。要使所有控件(内部窗体标题栏和客户端已装饰窗体标题栏除外)使用无格式字体,可以执行以下操作之一: 默认属性 swing.boldMetal(如果已设置)优先于同名的系统属性。设置此默认属性后,需要重新安装 MetalLookAndFeel,并更新所有以前创建的窗口小部件的 UI。否则,结果是不确定的。以下代码说明了如何进行此操作:
   // turn off bold fonts
   UIManager.put("swing.boldMetal", Boolean.FALSE);

   // 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);
 

警告:此类的序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储或运行相同 Swing 版本的应用程序之间的 RMI。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder

另请参见:
MetalLookAndFeel, MetalLookAndFeel.setCurrentTheme(javax.swing.plaf.metal.MetalTheme)

构造方法摘要
DefaultMetalTheme()
          创建并返回 DefaultMetalTheme 的一个实例。
 
方法摘要
 FontUIResource getControlTextFont()
          返回控件文本字体。
 FontUIResource getMenuTextFont()
          返回菜单文本字体。
 String getName()
          返回此主题的名称。
protected  ColorUIResource getPrimary1()
          返回 primary 1 颜色。
protected  ColorUIResource getPrimary2()
          返回 primary 2 颜色。
protected  ColorUIResource getPrimary3()
          返回 primary 3 颜色。
protected  ColorUIResource getSecondary1()
          返回 secondary 1 颜色。
protected  ColorUIResource getSecondary2()
          返回 secondary 2 颜色。
protected  ColorUIResource getSecondary3()
          返回 secondary 3 颜色。
 FontUIResource getSubTextFont()
          返回子文本字体。
 FontUIResource getSystemTextFont()
          返回系统文本字体。
 FontUIResource getUserTextFont()
          返回用户文本字体。
 FontUIResource getWindowTitleFont()
          返回窗口标题字体。
 
从类 javax.swing.plaf.metal.MetalTheme 继承的方法
addCustomEntriesToTable, getAcceleratorForeground, getAcceleratorSelectedForeground, getBlack, getControl, getControlDarkShadow, getControlDisabled, getControlHighlight, getControlInfo, getControlShadow, getControlTextColor, getDesktopColor, getFocusColor, getHighlightedTextColor, getInactiveControlTextColor, getInactiveSystemTextColor, getMenuBackground, getMenuDisabledForeground, getMenuForeground, getMenuSelectedBackground, getMenuSelectedForeground, getPrimaryControl, getPrimaryControlDarkShadow, getPrimaryControlHighlight, getPrimaryControlInfo, getPrimaryControlShadow, getSeparatorBackground, getSeparatorForeground, getSystemTextColor, getTextHighlightColor, getUserTextColor, getWhite, getWindowBackground, getWindowTitleBackground, getWindowTitleForeground, getWindowTitleInactiveBackground, getWindowTitleInactiveForeground
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

DefaultMetalTheme

public DefaultMetalTheme()
创建并返回 DefaultMetalTheme 的一个实例。

方法详细信息

getName

public String getName()
返回此主题的名称。此方法返回 "Steel"

指定者:
MetalTheme 中的 getName
返回:
此主题的名称

getPrimary1

protected ColorUIResource getPrimary1()
返回 primary 1 颜色。此方法返回 rgb 值分别为 102、102 和 153 的颜色。

指定者:
MetalTheme 中的 getPrimary1
返回:
primary 1 颜色

getPrimary2

protected ColorUIResource getPrimary2()
返回 primary 2 颜色。此方法返回 rgb 值分别为 153、153、204 的颜色。

指定者:
MetalTheme 中的 getPrimary2
返回:
primary 2 颜色

getPrimary3

protected ColorUIResource getPrimary3()
返回 primary 3 颜色。此方法返回 rgb 值分别为 204、204、255 的颜色。

指定者:
MetalTheme 中的 getPrimary3
返回:
primary 3 颜色

getSecondary1

protected ColorUIResource getSecondary1()
返回 secondary 1 颜色。此方法返回 rgb 值分别为 102、102 和 102 的颜色。

指定者:
MetalTheme 中的 getSecondary1
返回:
secondary 1 颜色

getSecondary2

protected ColorUIResource getSecondary2()
返回 secondary 2 颜色。此方法返回 rgb 值分别为 153、153 和 153 的颜色。

指定者:
MetalTheme 中的 getSecondary2
返回:
secondary 2 颜色

getSecondary3

protected ColorUIResource getSecondary3()
返回 secondary 3 颜色。此方法返回 rgb 值分别为 204、204 和 204 的颜色。

指定者:
MetalTheme 中的 getSecondary3
返回:
secondary 3 颜色

getControlTextFont

public FontUIResource getControlTextFont()
返回控件文本字体。此方法返回 Dialog、12pt。如果如字体样式中所述启用了无格式字体,则字体样式为无格式的。否则,字体样式为黑体。

指定者:
MetalTheme 中的 getControlTextFont
返回:
控件文本字体

getSystemTextFont

public FontUIResource getSystemTextFont()
返回系统文本字体。此方法返回 Dialog、12pt、无格式。

指定者:
MetalTheme 中的 getSystemTextFont
返回:
系统文本字体

getUserTextFont

public FontUIResource getUserTextFont()
返回用户文本字体。此方法返回 Dialog、12pt、无格式。

指定者:
MetalTheme 中的 getUserTextFont
返回:
用户文本字体

getMenuTextFont

public FontUIResource getMenuTextFont()
返回菜单文本字体。此方法返回 Dialog、12pt。如果如字体样式中所述启用了无格式字体,则字体样式为无格式的。否则,字体样式为黑体。

指定者:
MetalTheme 中的 getMenuTextFont
返回:
菜单文本字体

getWindowTitleFont

public FontUIResource getWindowTitleFont()
返回窗口标题字体。此方法返回 Dialog、12pt、黑体。

指定者:
MetalTheme 中的 getWindowTitleFont
返回:
窗口标题字体

getSubTextFont

public FontUIResource getSubTextFont()
返回子文本字体。此方法返回 Dialog、10pt、无格式。

指定者:
MetalTheme 中的 getSubTextFont
返回:
子文本字体

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策