JavaTM 2 Platform
Standard Ed. 6

javax.swing.plaf.multi
类 MultiLookAndFeel

java.lang.Object
  继承者 javax.swing.LookAndFeel
      继承者 javax.swing.plaf.multi.MultiLookAndFeel

public class MultiLookAndFeel
extends LookAndFeel

多路外观允许同时将多个 UI 与一个组件相关联。主外观称为默认 外观,而其他外观则称为辅助 外观。

有关更多信息,请参阅 Using the Multiplexing Look and Feel

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

另请参见:
UIManager.addAuxiliaryLookAndFeel(javax.swing.LookAndFeel), javax.swing.plaf.multi

构造方法摘要
MultiLookAndFeel()
           
 
方法摘要
static ComponentUI createUIs(ComponentUI mui, Vector uis, JComponent target)
          创建表示 target 组件所需的 ComponentUI 对象,将对象放入 uis 向量中,并返回最能表示该组件 UI 的 ComponentUI 对象。
 UIDefaults getDefaults()
          创建、初始化并返回特定于外观的默认值。
 String getDescription()
          返回对此外观的一行描述。
 String getID()
          返回适合应用程序/服务使用、标识此外观的 string。
 String getName()
          返回适合在菜单中使用、标识此外观的 string。
 boolean isNativeLookAndFeel()
          返回 false;此外观对于任意平台而言不是本机的。
 boolean isSupportedLookAndFeel()
          返回 true;所有平台都允许此外观。
protected static ComponentUI[] uisToArray(Vector uis)
          创建一个数组,使用来自传入向量的 UI 对象填充它并返回该数组。
 
从类 javax.swing.LookAndFeel 继承的方法
getDesktopPropertyValue, getDisabledIcon, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, initialize, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninitialize, uninstallBorder
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

MultiLookAndFeel

public MultiLookAndFeel()
方法详细信息

getName

public String getName()
返回适合在菜单中使用、标识此外观的 string。

指定者:
LookAndFeel 中的 getName
返回:
一个 string,如 "Multiplexing Look and Feel"

getID

public String getID()
返回适合应用程序/服务使用、标识此外观的 string。

指定者:
LookAndFeel 中的 getID
返回:
"Multiplex"

getDescription

public String getDescription()
返回对此外观的一行描述。

指定者:
LookAndFeel 中的 getDescription
返回:
描述性的 string,如 "Allows multiple UI instances per component instance"

isNativeLookAndFeel

public boolean isNativeLookAndFeel()
返回 false;此外观对于任意平台而言不是本机的。

指定者:
LookAndFeel 中的 isNativeLookAndFeel
返回:
false

isSupportedLookAndFeel

public boolean isSupportedLookAndFeel()
返回 true;所有平台都允许此外观。

指定者:
LookAndFeel 中的 isSupportedLookAndFeel
返回:
true
另请参见:
UIManager.setLookAndFeel(javax.swing.LookAndFeel)

getDefaults

public UIDefaults getDefaults()
创建、初始化并返回特定于外观的默认值。对于此外观,默认仅包括 UI 类 ID(如 "ButtonUI")与 ComponentUI 类名称(如 "javax.swing.plaf.multi.MultiButtonUI")的映射关系。

覆盖:
LookAndFeel 中的 getDefaults
返回:
已初始化的 UIDefaults 对象
另请参见:
JComponent.getUIClassID()

createUIs

public static ComponentUI createUIs(ComponentUI mui,
                                    Vector uis,
                                    JComponent target)
创建表示 target 组件所需的 ComponentUI 对象,将对象放入 uis 向量中,并返回最能表示该组件 UI 的 ComponentUI 对象。此方法查找 ComponentUI 对象,方法是在当前使用的所有默认和辅助外观上调用 getDefaults().getUI(target)。此方法添加到 uis 向量中的第一个 UI 对象是针对默认外观的。

此方法由 MultiXxxxUI 类的 createUI 方法调用。

参数:
mui - 表示 target 组件完整 UI 的 ComponentUI 对象;这应该是某个 MultiXxxxUI 类的实例
uis - 一个 Vector;通常这是 mui 参数的 uis 字段
target - 一个组件,由 mui 表示其 UI
返回:
如果该组件有辅助 UI 对象,则返回 mui;否则返回默认外观的 UI 对象,如果无法找到默认 UI 对象,则返回 null
另请参见:
UIManager.getAuxiliaryLookAndFeels(), UIDefaults.getUI(javax.swing.JComponent), MultiButtonUI.uis, MultiButtonUI.createUI(javax.swing.JComponent)

uisToArray

protected static ComponentUI[] uisToArray(Vector uis)
创建一个数组,使用来自传入向量的 UI 对象填充它并返回该数组。如果 uis 为 null,则此方法返回具有零元素的数组。如果 uis 是空向量,则此方法返回 null。如果 uis 向量中的任何对象不是 ComponentUI 类型的,则出现运行时错误。

参数:
uis - 包含 ComponentUI 对象的向量
返回:
等同于传入向量的数组

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only