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 设置为 false。例如 java -Dswing.boldMetal=false MyApp
  • 将默认属性 swing.boldMetal 设置为 Boolean.FALSE。例如:UIManager.put("swing.boldMetal", Boolean.FALSE);
默认属性 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 的一个实例。
 
方法摘要
 FontUIResourcegetControlTextFont()
          返回控件文本字体。
 FontUIResourcegetMenuTextFont()
          返回菜单文本字体。
 StringgetName()
          返回此主题的名称。
protected  ColorUIResourcegetPrimary1()
          返回 primary 1 颜色。
protected  ColorUIResourcegetPrimary2()
          返回 primary 2 颜色。
protected  ColorUIResourcegetPrimary3()
          返回 primary 3 颜色。
protected  ColorUIResourcegetSecondary1()
          返回 secondary 1 颜色。
protected  ColorUIResourcegetSecondary2()
          返回 secondary 2 颜色。
protected  ColorUIResourcegetSecondary3()
          返回 secondary 3 颜色。
 FontUIResourcegetSubTextFont()
          返回子文本字体。
 FontUIResourcegetSystemTextFont()
          返回系统文本字体。
 FontUIResourcegetUserTextFont()
          返回用户文本字体。
 FontUIResourcegetWindowTitleFont()
          返回窗口标题字体。
 
从类 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 颜色