|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.swing.LookAndFeel
public abstract class LookAndFeel
从可插入外观组件的角度全面展现外观的特性。
| 构造方法摘要 | |
|---|---|
LookAndFeel()
|
|
| 方法摘要 | |
|---|---|
UIDefaults |
getDefaults()
此方法由 UIManager.setLookAndFeel 调用一次以创建特定于外观的默认表。 |
abstract String |
getDescription()
返回对此外观实现的单行描述,例如,"The CDE/Motif Look and Feel"。 |
static Object |
getDesktopPropertyValue(String systemPropertyName,
Object fallbackValue)
通过调用 Toolkit.getDefaultToolkit().getDesktopProperty() 返回指定系统桌面属性的值。 |
Icon |
getDisabledIcon(JComponent component,
Icon icon)
返回具有禁用外观的 Icon。 |
Icon |
getDisabledSelectedIcon(JComponent component,
Icon icon)
返回由选定的禁用组件使用的 Icon。 |
abstract String |
getID()
返回标识此外观的字符串。 |
abstract String |
getName()
返回标识此外观的短字符串,例如 "CDE/Motif"。 |
boolean |
getSupportsWindowDecorations()
如果 RootPaneUI 实例返回的 LookAndFeel 支持提供 JRootPane 中 Window 的装饰,则返回 true。 |
void |
initialize()
UIManager.setLookAndFeel 在首次调用(通常是惟一的调用)getDefaults() 之前调用此方法。 |
static void |
installBorder(JComponent c,
String defaultBorderName)
在指定组件上安装组件的默认 Border 对象的便捷方法,条件是该边框当前为 null 或者已经是 UIResource 的实例。 |
static void |
installColors(JComponent c,
String defaultBgName,
String defaultFgName)
使用当前默认表中的值初始化组件的前景和背景颜色属性的便捷方法。 |
static void |
installColorsAndFont(JComponent c,
String defaultBgName,
String defaultFgName,
String defaultFontName)
使用当前默认表中的值初始化组件前景、背景和字体属性的便捷方法。 |
static void |
installProperty(JComponent c,
String propertyName,
Object propertyValue)
在组件上安装具有指定名称和值的属性的便捷方法,条件是该属性尚未由客户端程序设置。 |
abstract boolean |
isNativeLookAndFeel()
如果基础平台具有“本机”外观,而且这是对它的一个实现,则返回 true。 |
abstract boolean |
isSupportedLookAndFeel()
如果基础平台支持和/或允许此外观,则返回 true。 |
static void |
loadKeyBindings(InputMap retMap,
Object[] keys)
将 key 中的绑定加载到 retMap 中。 |
static ComponentInputMap |
makeComponentInputMap(JComponent c,
Object[] keys)
从 key 创建一个 ComponentInputMap。 |
static Object |
makeIcon(Class<?> baseClass,
String gifFile)
创建 UIDefaults.LazyValue 的实用方法,前者为指定的 gifFile 文件名创建 ImageIcon UIResource。 |
static InputMap |
makeInputMap(Object[] keys)
从 key 创建一个 InputMap。 |
static JTextComponent.KeyBinding[] |
makeKeyBindings(Object[] keyBindingList)
构建 KeyBindings 列表的便捷方法。 |
void |
provideErrorFeedback(Component component)
在用户尝试一个无效操作时调用,例如,在具有焦点的不可编辑的 JTextField 中进行粘贴。 |
String |
toString()
返回显示和标识此对象属性的字符串。 |
void |
uninitialize()
UIManager.setLookAndFeel 仅在我们使用新的默认外观替换之前调用此方法。 |
static void |
uninstallBorder(JComponent c)
在指定组件上卸载组件的默认边框的便捷方法,条件是该边框当前是 UIResource 的实例。 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 构造方法详细信息 |
|---|
public LookAndFeel()
| 方法详细信息 |
|---|
public static void installColors(JComponent c,
String defaultBgName,
String defaultFgName)
c - 安装默认颜色/字体属性的目标组件defaultBgName - 默认背景的键defaultFgName - 默认前景的键installColorsAndFont(javax.swing.JComponent, java.lang.String, java.lang.String, java.lang.String),
UIManager.getColor(java.lang.Object)
public static void installColorsAndFont(JComponent c,
String defaultBgName,
String defaultFgName,
String defaultFontName)
c - 安装默认颜色/字体属性的目标组件defaultBgName - 默认背景的键defaultFgName - 默认前景的键defaultFontName - 默认字体的键installColors(javax.swing.JComponent, java.lang.String, java.lang.String),
UIManager.getColor(java.lang.Object),
UIManager.getFont(java.lang.Object)
public static void installBorder(JComponent c,
String defaultBorderName)
c - 安装默认边框的目标组件defaultBorderName - 指定默认边框的键public static void uninstallBorder(JComponent c)
c - 卸载默认边框的目标组件
public static void installProperty(JComponent c,
String propertyName,
Object propertyValue)
c - 安装属性的目标组件propertyName - 包含要设置的属性名的字符串propertyValue - 包含该属性值的对象
IllegalArgumentException - 如果指定的属性不是可以使用此方法设置的属性
ClassCastException - 指定的属性值与该属性的类型不匹配时抛出
NullPointerException - 在 c 或 propertyValue 为 null 时抛出public static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList)
返回 KeyBindings 的数组,其中的每个元素都是 keyBindingList 中一个 KeyStroke,Action 对。KeyStroke 可以是由 KeyStroke.getKeyStroke 方法指定格式的字符串,或者是一个 KeyStroke 对象。
操作为字符串。下面是一个示例:
JTextComponent.KeyBinding[] multilineBindings = makeKeyBindings( new Object[] {
"UP", DefaultEditorKit.upAction,
"DOWN", DefaultEditorKit.downAction,
"PAGE_UP", DefaultEditorKit.pageUpAction,
"PAGE_DOWN", DefaultEditorKit.pageDownAction,
"ENTER", DefaultEditorKit.insertBreakAction,
"TAB", DefaultEditorKit.insertTabAction
});
keyBindingList - KeyStroke,Action 对的数组
public static InputMap makeInputMap(Object[] keys)
key 创建一个 InputMap。key 描述了 InputMap,每个偶数项作为一个字符串,按 KeyStroke.getKeyStroke(String)(或者一个 KeyStroke)中的说明给出 KeyStroke,Object 使用的每个奇数项用来确定 ActionMap 中关联的 Action。
public static ComponentInputMap makeComponentInputMap(JComponent c,
Object[] keys)
key 创建一个 ComponentInputMap。key 描述了 InputMap,每个偶数项作为一个字符串,按 KeyStroke.getKeyStroke(String)(或者一个 KeyStroke)中的说明给出 KeyStroke,Object 使用的每个奇数项用来确定 ActionMap 中关联的 Action。
public static void loadKeyBindings(InputMap retMap,
Object[] keys)
key 中的绑定加载到 retMap 中。这不会移除 retMap 中任何现有的绑定。key 描述了 InputMap,每个偶数项作为一个字符串,按 KeyStroke.getKeyStroke(String)(或者一个 KeyStroke)中的说明给出 KeyStroke,Object 使用的每个奇数项用来确定 ActionMap 中关联的 Action。
public static Object makeIcon(Class<?> baseClass,
String gifFile)
gifFile 文件名创建 ImageIcon UIResource。
public void provideErrorFeedback(Component component)
JTextField 中进行粘贴。默认实现蜂鸣。期待不同行为的子类应重写它,并提供其他的反馈。
component - 其中发生错误的 Component,可以为 null,指示错误条件与某个 Component 无关
public static Object getDesktopPropertyValue(String systemPropertyName,
Object fallbackValue)
Toolkit.getDefaultToolkit().getDesktopProperty() 返回指定系统桌面属性的值。如果指定属性的当前值为 null,则返回 fallbackValue。
systemPropertyName - 正被查询的系统桌面属性的名称fallbackValue - 在系统值为 null 时,要作为值返回的对象
Toolkit.getDesktopProperty(java.lang.String)
public Icon getDisabledIcon(JComponent component,
Icon icon)
Icon。此方法用于在未指定图标时生成被禁用的 Icon。例如,如果创建了一个 JButton,并通过 setIcon 仅指定了一个 Icon,则会调用此方法来生成被禁用的 Icon。如果 null 作为 icon 传递,则此方法将返回 null。
有些外观可能不呈现被禁用的 Icon,在此情况下这些外观将忽略它。
component - 将显示 Icon 的 JComponent,可以为 nullicon - 从其生成禁用图标的 Icon。
public Icon getDisabledSelectedIcon(JComponent component,
Icon icon)
Icon。此方法用于为以下情况的组件生成一个 Icon:这些组件均为禁用和选中状态,但没有此状态的指定 Icon。例如,如果创建了一个 JButton,并通过 setIcon 仅指定了一个 Icon,则会调用此方法来生成禁用和选中的 Icon。如果 null 作为 icon 传递,则此方法将返回 null。
有些外观可能不呈现禁用和选中的 Icon,在此情况下这些外观将忽略它。
component - 将显示 Icon 的 JComponent,可以为 nullicon - 从其生成禁用和选中图标的 Icon。
public abstract String getName()
public abstract String getID()
public abstract String getDescription()
public boolean getSupportsWindowDecorations()
RootPaneUI 实例返回的 LookAndFeel 支持提供 JRootPane 中 Window 的装饰,则返回 true。
默认实现返回 false,支持 Window 装饰的子类应重写它并返回 true。
JDialog.setDefaultLookAndFeelDecorated(boolean),
JFrame.setDefaultLookAndFeelDecorated(boolean),
JRootPane.setWindowDecorationStyle(int)public abstract boolean isNativeLookAndFeel()
public abstract boolean isSupportedLookAndFeel()
UIManager.setLookAndFeel(javax.swing.LookAndFeel)public void initialize()
uninitialize(),
UIManager.setLookAndFeel(javax.swing.LookAndFeel)public void uninitialize()
initialize()public UIDefaults getDefaults()
initialize(),
uninitialize(),
UIManager.setLookAndFeel(javax.swing.LookAndFeel)public String toString()
Object 中的 toString
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。