JavaTM 2 Platform
Standard Ed. 6

javax.swing.plaf.metal
类 MetalRootPaneUI

java.lang.Object
  继承者 javax.swing.plaf.ComponentUI
      继承者 javax.swing.plaf.RootPaneUI
          继承者 javax.swing.plaf.basic.BasicRootPaneUI
              继承者 javax.swing.plaf.metal.MetalRootPaneUI
所有已实现的接口:
PropertyChangeListener, EventListener

public class MetalRootPaneUI
extends BasicRootPaneUI

提供 RootPaneUI 的 metal 外观实现。

MetalRootPaneUI 提供对 JRootPanewindowDecorationStyle 属性的支持。MetalRootPaneUI 通过安装一个自定义 LayoutManager、一个呈现适当窗口小部件的私有 Component 和一个私有 Border 来做到这一点。不管 windowDecorationStyle 属性的值如何,总是要安装 LayoutManager,但 BorderComponent 只在 windowDecorationStyle 不是 JRootPane.NONE 时才被安装/添加。

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

从以下版本开始:
1.4

构造方法摘要
MetalRootPaneUI()
           
 
方法摘要
static ComponentUI createUI(JComponent c)
          为 JRootPane 创建一个 UI。
 void installUI(JComponent c)
          调用 installUI 的超实现来在传入的 JRootPane 上安装必要的状态,以呈现 RootPaneUI 的 metal 外观实现。
 void propertyChange(PropertyChangeEvent e)
          属性更改时调用。
 void uninstallUI(JComponent c)
          调用超实现来卸载所有状态。
 
从类 javax.swing.plaf.basic.BasicRootPaneUI 继承的方法
installComponents, installDefaults, installKeyboardActions, installListeners, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners
 
从类 javax.swing.plaf.ComponentUI 继承的方法
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, paint, update
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

MetalRootPaneUI

public MetalRootPaneUI()
方法详细信息

createUI

public static ComponentUI createUI(JComponent c)
JRootPane 创建一个 UI。

参数:
c - 将为其创建 RootPaneUI 的 JRootPane
返回:
所传入 JRootPane 的 RootPaneUI 实现

installUI

public void installUI(JComponent c)
调用 installUI 的超实现来在传入的 JRootPane 上安装必要的状态,以呈现 RootPaneUI 的 metal 外观实现。如果 JRootPanewindowDecorationStyle 属性不是 JRootPane.NONE,则此方法将添加一个自定义 Component 来将窗口小部件呈现给 JRootPane,并在 JRootPane 上安装一个自定义 BorderLayoutManager

覆盖:
BasicRootPaneUI 中的 installUI
参数:
c - 在其上安装状态的 JRootPane
另请参见:
ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

uninstallUI

public void uninstallUI(JComponent c)
调用超实现来卸载所有状态。此方法还将重置 JRootPaneLayoutManager。如果已经将 Component 添加到 JRootPane 中来呈现窗口装饰风格,则此方法将移除它。类似地,此方法会将 JRootPane 的 Border 和 LayoutManager 恢复为调用 installUI 前的样子。

覆盖:
BasicRootPaneUI 中的 uninstallUI
参数:
c - 从其中卸载状态的 JRootPane
另请参见:
ComponentUI.installUI(javax.swing.JComponent), JComponent.updateUI()

propertyChange

public void propertyChange(PropertyChangeEvent e)
属性更改时调用。MetalRootPaneUI 主要用于源自 JRootPane(已安装它来标识属性 windowDecorationStyle)的事件。如果 windowDecorationStyle 已经更改为不是 JRootPane.NONE 的某个值,则此方法会向 JRootPane 添加一个 Component 来呈现窗口装饰,并在 JRootPane 上安装一个 Border。另一方面,如果 windowDecorationStyle 已更改为 JRootPane.NONE,则此方法将移除已添加到 JRootPane 中的 Component,并将 Border 重置回调用 installUI 以前的样子。

指定者:
接口 PropertyChangeListener 中的 propertyChange
覆盖:
BasicRootPaneUI 中的 propertyChange
参数:
e - 描述事件源和已更改的属性的 PropertyChangeEvent 对象。

JavaTM 2 Platform
Standard Ed. 6

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

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