|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.KeyboardFocusManager
public abstract class KeyboardFocusManager
KeyboardFocusManager 负责管理激活状态的聚焦 Window 和当前焦点所有者。焦点所有者的定义是:应用程序中的 Component,通常接收用户生成的所有 KeyEvent。聚焦 Window 指本身就是(或者包含)焦点所有者的 Window。只有 Frame 或 Dialog 才能成为活动 Window。本机的窗口操作系统可能使用特殊装饰(如高亮显示标题栏)来表示活动 Window 或其子窗口。活动 Window 要么是聚焦 Window,要么是作为聚焦 Window 所有者的第一个 Frame 或 Dialog。
KeyboardFocusManager 既是一个用于查询焦点所有者并启动焦点更改的客户端代码的集中位置,同时又是一个用于所有 FocusEvent、与焦点相关的 WindowEvent 和 KeyEvent 的调度程序。
有些浏览器将使用不同代码基数的 applet 划分为单独的上下文,并在这些上下文之间建墙分隔。在此方案中,每个上下文都将具有一个 KeyboardFocusManager。其他浏览器将所有 applet 置于同一个上下文中,这意味着仅存在一个用于所有 applet 的全局 KeyboardFocusManager。此行为是依赖于实现的。请参考浏览器文档以获取更多信息。然而,不管可能有多少上下文,每个 ClassLoader 的焦点所有者、聚焦 Window 或活动 Window 只能有一个。
请参见 How to Use the Focus Subsystem(The Java Tutorial 的一节)和 Focus Specification 以获取更多信息。
Window,
Frame,
Dialog,
FocusEvent,
WindowEvent,
KeyEvent
| 字段摘要 | |
|---|---|
static int |
BACKWARD_TRAVERSAL_KEYS Backward 焦点遍历键的标识符。 |
static int |
DOWN_CYCLE_TRAVERSAL_KEYS Down Cycle 焦点遍历键的标识符。 |
static int |
FORWARD_TRAVERSAL_KEYS Forward 焦点遍历键的标识符。 |
static int |
UP_CYCLE_TRAVERSAL_KEYS Up Cycle 焦点遍历键的标识符。 |
| 构造方法摘要 | |
|---|---|
KeyboardFocusManager() 初始化 KeyboardFocusManager。 |
|
| 方法摘要 | |
|---|---|
void |
addKeyEventDispatcher(KeyEventDispatcher dispatcher) 将 KeyEventDispatcher 添加到此 KeyboardFocusManager 的调度程序链中。 |
void |
addKeyEventPostProcessor(KeyEventPostProcessor processor) 将 KeyEventPostProcessor 添加到此 KeyboardFocusManager 的后处理器链中。 |
void |
addPropertyChangeListener(PropertyChangeListener listener) 将 PropertyChangeListener 添加到侦听器列表。 |
void |
addPropertyChangeListener(String propertyName, PropertyChangeListener listener) 将 PropertyChangeListener 添加到特定属性的侦听器列表。 |
void |
addVetoableChangeListener(String propertyName, VetoableChangeListener listener) 将 VetoableChangeListener 添加到特定属性的侦听器列表。 |
void |
addVetoableChangeListener(VetoableChangeListener listener) 将 VetoableChangeListener 添加到侦听器列表。 |
void |
clearGlobalFocusOwner() 在 Java 和本机级别清除全局焦点所有者。 |
protected abstract void |
dequeueKeyEvents(long after, Component untilFocused) 由 AWT 调用以通知 KeyboardFocusManager 应该取消延迟指派 KeyEvent。 |
protected abstract void |
discardKeyEvents(Component comp) 由 AWT 调用以通知 KeyboardFocusManager 应该取消延迟指派 KeyEvent。 |
abstract boolean |
dispatchEvent(AWTEvent e) AWT 事件调度程序可以调用此方法,请求当前的 KeyboardFocusManager 为其指派指定的事件。 |
abstract boolean |
dispatchKeyEvent(KeyEvent e) 通常情况下,如果该指派程序链中的其他 KeyEventDispatcher 没有指派 KeyEvent 或者没有注册其他 KeyEventDispatcher,则 dispatchEvent 将调用此方法。 |
void |
downFocusCycle() 当且仅当当前焦点所有者是一个作为焦点循环根的 Container 时,从当前焦点所有者将焦点下移一个焦点遍历循环。 |
abstract void |
downFocusCycle(Container aContainer) 将焦点下移一个焦点遍历循环。 |
protected abstract void |
enqueueKeyEvents(long after, Component untilFocused) 在指定的 Component 成为焦点所有者以前由 AWT 调用,以通知 KeyboardFocusManager 延迟指派 KeyEvent。 |
protected void |
firePropertyChange(String propertyName, Object oldValue, Object newValue) 激发 PropertyChangeEvent 以响应绑定属性中的更改。 |
protected void |
fireVetoableChange(String propertyName, Object oldValue, Object newValue) 激发 PropertyChangeEvent 以响应可否决属性中的更改。 |
void |
focusNextComponent() 聚焦当前焦点所有者之后的 Component。 |
abstract void |
focusNextComponent(Component aComponent) 聚焦 aComponent 之后的 Component,通常基于 FocusTraversalPolicy。 |
void |
focusPreviousComponent() 聚焦当前焦点所有者之前的 Component。 |
abstract void |
focusPreviousComponent(Component aComponent) 聚焦 aComponent 之前的 Component,通常基于 FocusTraversalPolicy。 |
Window |
getActiveWindow() 如果活动 Window 与调用线程位于同一个上下文中,则返回活动 Window。 |
Container |
getCurrentFocusCycleRoot() 如果当前焦点循环根与调用线程位于相同的上下文中,则返回当前焦点循环根。 |
static KeyboardFocusManager |
getCurrentKeyboardFocusManager() 返回调用线程上下文的当前 KeyboardFocusManager 实例。 |
Set<AWTKeyStroke> |
getDefaultFocusTraversalKeys(int id) 返回给定遍历操作的默认焦点遍历键的 Set。 |
FocusTraversalPolicy |
getDefaultFocusTraversalPolicy() 返回默认 FocusTraversalPolicy。 |
Window |
getFocusedWindow() 如果聚焦窗口与调用线程位于同一个上下文中,则返回聚焦窗口。 |
Component |
getFocusOwner() 如果焦点所有者与调用线程位于同一个上下文中,则返回该焦点所有者。 |
protected Window |
getGlobalActiveWindow() 返回活动 Window,即使调用线程处于活动 Window 之外的上下文中。 |
protected Container |
getGlobalCurrentFocusCycleRoot() 返回当前焦点循环根,即使调用线程处于当前焦点循环根之外的上下文中。 |
protected Window |
getGlobalFocusedWindow() 返回聚焦 Window,即使调用线程处于聚焦 Window 之外的上下文中。 |
protected Component |
getGlobalFocusOwner() 返回焦点所有者,即使调用线程处于焦点所有者之外的上下文中。 |
protected Component |
getGlobalPermanentFocusOwner() 返回持久焦点所有者,即使调用线程处于该持久焦点所有者之外的上下文中。 |
protected List<KeyEventDispatcher> |
getKeyEventDispatchers() 作为 List 返回此 KeyboardFocusManager 的 KeyEventDispatcher 链。 |
protected List<KeyEventPostProcessor> |
getKeyEventPostProcessors() 作为 List 返回此 KeyboardFocusManager 的 KeyEventPostProcessor 链。 |
Component |
getPermanentFocusOwner() 如果持久焦点所有者与调用线程位于同一个上下文中,则返回持久焦点所有者。 |
PropertyChangeListener[] |
getPropertyChangeListeners() 返回在此键盘焦点管理器上注册的所有属性更改侦听器组成的数组。 |
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName) 返回与指定属性相关联的所有 PropertyChangeListener 组成的数组。 |
VetoableChangeListener[] |
getVetoableChangeListeners() 返回在此键盘焦点管理器上注册的所有可否决更改侦听器组成的数组。 |
VetoableChangeListener[] |
getVetoableChangeListeners(String propertyName) 返回与指定属性相关联的所有 VetoableChangeListener 组成的数组。 |
abstract boolean |
postProcessKeyEvent(KeyEvent e) dispatchKeyEvent 将调用此方法。 |
abstract void |
processKeyEvent(Component focusedComponent, KeyEvent e) 当且仅当该 KeyEvent 表示指定 focusedComponent 的焦点遍历键时,此方法启动焦点遍历操作。 |
void |
redispatchEvent(Component target, AWTEvent e) 重新指派 AWTEvent 的方式是,AWT 事件调度程序不会递归式请求 KeyboardFocusManager 或任何已安装的 KeyEventDispatcher 再次指派该事件。 |
void |
removeKeyEventDispatcher(KeyEventDispatcher dispatcher) 移除以前添加到此 KeyboardFocusManager 调度程序链中的 KeyEventDispatcher。 |
void |
removeKeyEventPostProcessor(KeyEventPostProcessor processor) 从此 KeyboardFocusManager 的后处理器链中移除以前添加的 KeyEventPostProcessor。 |
void |
removePropertyChangeListener(PropertyChangeListener listener) 从侦听器列表移除 PropertyChangeListener。 |
void |
removePropertyChangeListener(String propertyName, PropertyChangeListener listener) 从特定属性的侦听器列表移除 PropertyChangeListener。 |
void |
removeVetoableChangeListener(String propertyName, VetoableChangeListener listener) 从特定属性的侦听器列表移除 VetoableChangeListener。 |
void |
removeVetoableChangeListener(VetoableChangeListener listener) 从侦听器列表移除 VetoableChangeListener。 |
static void |
setCurrentKeyboardFocusManager(KeyboardFocusManager newManager) 设置调用线程上下文的当前 KeyboardFocusManager 实例。 |
void |
setDefaultFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes) 设置给定遍历操作的默认焦点遍历键。 |
void |
setDefaultFocusTraversalPolicy(FocusTraversalPolicy defaultPolicy) 设置默认 FocusTraversalPolicy。 |
protected void |
setGlobalActiveWindow(Window activeWindow) 设置活动 Window。 |
void |
setGlobalCurrentFocusCycleRoot(Container newFocusCycleRoot) 设置当前焦点循环根。 |
protected void |
setGlobalFocusedWindow(Window focusedWindow) 设置聚焦 Window。 |
protected void |
setGlobalFocusOwner(Component focusOwner) 设置焦点所有者。 |
protected void |
setGlobalPermanentFocusOwner(Component permanentFocusOwner) 设置持久焦点所有者。 |
void |
upFocusCycle() 从当前焦点所有者将焦点上移一个焦点遍历循环。 |
abstract void |
upFocusCycle(Component aComponent) 将焦点上移一个焦点遍历循环。 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
public static final int FORWARD_TRAVERSAL_KEYS
setDefaultFocusTraversalKeys(int, java.util.Set
),
getDefaultFocusTraversalKeys(int),
Component.setFocusTraversalKeys(int, java.util.Set
),
Component.getFocusTraversalKeys(int),
常量字段值
public static final int BACKWARD_TRAVERSAL_KEYS
setDefaultFocusTraversalKeys(int, java.util.Set
),
getDefaultFocusTraversalKeys(int),
Component.setFocusTraversalKeys(int, java.util.Set
),
Component.getFocusTraversalKeys(int),
常量字段值
public static final int UP_CYCLE_TRAVERSAL_KEYS
setDefaultFocusTraversalKeys(int, java.util.Set
),
getDefaultFocusTraversalKeys(int),
Component.setFocusTraversalKeys(int, java.util.Set
),
Component.getFocusTraversalKeys(int),
常量字段值
public static final int DOWN_CYCLE_TRAVERSAL_KEYS
setDefaultFocusTraversalKeys(int, java.util.Set
),
getDefaultFocusTraversalKeys(int),
Component.setFocusTraversalKeys(int, java.util.Set
),
Component.getFocusTraversalKeys(int),
常量字段值
| 构造方法详细信息 |
|---|
public KeyboardFocusManager()
| 方法详细信息 |
|---|
public static KeyboardFocusManager getCurrentKeyboardFocusManager()
setCurrentKeyboardFocusManager(java.awt.KeyboardFocusManager)
public static void setCurrentKeyboardFocusManager(KeyboardFocusManager newManager)
throws SecurityException
如果安装了 SecurityManager,则必须授予调用线程 AWTPermission "replaceKeyboardFocusManager" 才能替换当前 KeyboardFocusManager。如果未授予该权限,则此方法将抛出 SecurityException,而当前的 KeyboardFocusManager 不会改变。
newManager - 此线程上下文的新 KeyboardFocusManager
SecurityException - 如果调用线程不具有替换当前 KeyboardFocusManager 的权限
getCurrentKeyboardFocusManager(),
DefaultKeyboardFocusManager
public Component getFocusOwner()
getGlobalFocusOwner(),
setGlobalFocusOwner(java.awt.Component)
protected Component getGlobalFocusOwner()
throws SecurityException
如果此 KeyboardFocusManager 调用的不是线程上下文的当前 KeyboardFocusManager,则此方法将抛出 SecurityException。
SecurityException - 如果此 KeyboardFocusManager 调用的不是线程上下文的当前 KeyboardFocusManager
getFocusOwner(),
setGlobalFocusOwner(java.awt.Component)
protected void setGlobalFocusOwner(Component focusOwner)
此方法实际上没有将焦点设置为指定的 Component。它只存储该值,以便以后由 getFocusOwner() 返回它。更改焦点所有者需要使用 Component.requestFocus() 或 Component.requestFocusInWindow(),具体的使用因平台而异。
focusOwner - 焦点所有者
getFocusOwner(),
getGlobalFocusOwner(),
Component.requestFocus(),
Component.requestFocusInWindow(),
Component.isFocusable()
public void clearGlobalFocusOwner()
requestFocus() 为 Component 显式分配焦点之前,本机窗口操作系统将放弃所有用户生成的 KeyEvent。此操作不改变聚焦或激活状态的 Window。
Component.requestFocus(),
FocusEvent.FOCUS_LOST
public Component getPermanentFocusOwner()
getGlobalPermanentFocusOwner(),
setGlobalPermanentFocusOwner(java.awt.Component)
protected Component getGlobalPermanentFocusOwner()
throws SecurityException
如果此 KeyboardFocusManager 调用的不是线程上下文的当前 KeyboardFocusManager,则此方法将抛出 SecurityException。
SecurityException - 如果此 KeyboardFocusManager 调用的不是线程上下文的当前 KeyboardFocusManager
getPermanentFocusOwner(),
setGlobalPermanentFocusOwner(java.awt.Component)
protected void setGlobalPermanentFocusOwner(Component permanentFocusOwner)
此方法实际上没有将焦点设置为指定的 Component。它只存储该值,以便以后由 getPermanentFocusOwner() 返回它。更改焦点所有者需要使用 Component.requestFocus() 或 Component.requestFocusInWindow(),因平台而异。
permanentFocusOwner - 持久焦点所有者
getPermanentFocusOwner(),
getGlobalPermanentFocusOwner(),
Component.requestFocus(),
Component.requestFocusInWindow(),
Component.isFocusable()
public Window getFocusedWindow()
getGlobalFocusedWindow(),
setGlobalFocusedWindow(java.awt.Window)
protected Window getGlobalFocusedWindow()
throws SecurityException
如果此 KeyboardFocusManager 调用的不是线程上下文的当前 KeyboardFocusManager,则此方法将抛出 SecurityException。
SecurityException - 如果此 KeyboardFocusManager 调用的不是线程上下文的当前 KeyboardFocusManager
getFocusedWindow(),
setGlobalFocusedWindow(java.awt.Window)
protected void setGlobalFocusedWindow(Window focusedWindow)
此方法不能实际更改与本机窗口操作系统相关的聚焦 Window。它只存储该值,以便以后由 getFocusedWindow() 返回它。更改聚焦 Window 需要使用 Component.requestFocus() 或 Component.requestFocusInWindow(),因平台而异。
focusedWindow - 聚焦 Window
getFocusedWindow(),
getGlobalFocusedWindow(),
Component.requestFocus(),
Component.requestFocusInWindow(),
Window.isFocusableWindow()
public Window getActiveWindow()
getGlobalActiveWindow(),
setGlobalActiveWindow(java.awt.Window)
protected Window getGlobalActiveWindow()
throws SecurityException
如果此 KeyboardFocusManager 调用的不是线程上下文的当前 KeyboardFocusManager,则此方法将抛出 SecurityException。
SecurityException - 如果此 KeyboardFocusManager 调用的不是线程上下文的当前 KeyboardFocusManager
getActiveWindow(),
setGlobalActiveWindow(java.awt.Window)
protected void setGlobalActiveWindow(Window activeWindow)
此方法不能实际更改与本机窗口操作系统相关的活动 Window。它只存储该值,以便以后由 getActiveWindow() 返回它。更改活动 Window 需要使用 Component.requestFocus() 或 Component.requestFocusInWindow(),因平台而异。
activeWindow - 活动 Window
getActiveWindow(),
getGlobalActiveWindow(),
Component.requestFocus(),
Component.requestFocusInWindow()
public FocusTraversalPolicy getDefaultFocusTraversalPolicy()
setDefaultFocusTraversalPolicy(java.awt.FocusTraversalPolicy),
Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy),
Container.getFocusTraversalPolicy()
public void setDefaultFocusTraversalPolicy(FocusTraversalPolicy defaultPolicy)
defaultPolicy - 新的默认 FocusTraversalPolicy
IllegalArgumentException - 如果 defaultPolicy 为 null
getDefaultFocusTraversalPolicy(),
Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy),
Container.getFocusTraversalPolicy()
public void setDefaultFocusTraversalKeys(int id,
Set<? extends AWTKeyStroke> keystrokes)
Set 对没有显式定义自己的这种
Set 的所有
Window 均有效。对于没有显式定义自己的这种
Set 的
Windows 而言,此
Set 还可以由其子
Component 递归式继承。
默认焦点遍历键的默认值是依赖于实现的。Sun 建议特定本机平台的所有实现都使用相同的默认值。下面列出了对 Windows 和 Unix 的建议。这些建议用于 Sun AWT 实现中。
| 标识符 | 意义 | 默认值 |
|---|---|---|
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS |
正常向前键盘遍历 | TAB on KEY_PRESSED, CTRL-TAB on KEY_PRESSED |
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS |
正常反向键盘遍历 | SHIFT-TAB on KEY_PRESSED, CTRL-SHIFT-TAB on KEY_PRESSED |
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS |
向上一个焦点遍历循环 | none |
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS |
向下一个焦点遍历循环 | none |
Set;建议使用
Collections.EMPTY_SET。
使用 AWTKeyStroke API,客户端代码可以指定在两个特定 KeyEvent 的哪一个上进行焦点遍历,KEY_PRESSED 还是 KEY_RELEASED。不管指定哪一个 KeyEvent,所有与焦点遍历键相关的 KeyEvent(包括关联的 KEY_TYPED 事件)都将被使用,不会将其指派给任何 Component。将 KEY_TYPED 事件指定为映射为焦点遍历操作或将同一事件映射为多个默认焦点遍历操作都是运行时错误。
id -
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS、
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS、
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS 和
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS 其中之一
keystrokes - 指定操作的
AWTKeyStroke Set
IllegalArgumentException - 如果 id 不是
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS、
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS、
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS 和
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS 其中之一,或者击键为
null,或者击键包含
null,或者击键中的任何
Object 不是
AWTKeyStroke,或者击键表示
KEY_TYPED 事件,或者击键已映射为别的默认焦点遍历操作
getDefaultFocusTraversalKeys(int),
Component.setFocusTraversalKeys(int, java.util.Set
),
Component.getFocusTraversalKeys(int)
public Set<AWTKeyStroke> getDefaultFocusTraversalKeys(int id)
setDefaultFocusTraversalKeys 以获取每个操作的完整描述。)
id - KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS、KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS、KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS 和 KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS 其中之一
AWTKeyStroke
Set;该
Set 不可修改,并且可以为空;永远不会返回
null
IllegalArgumentException - 如果 id 不是 KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS、KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS、KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS 和 KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS 其中之一
setDefaultFocusTraversalKeys(int, java.util.Set
),
Component.setFocusTraversalKeys(int, java.util.Set
),
Component.getFocusTraversalKeys(int)
public Container getCurrentFocusCycleRoot()
此方法仅供 KeyboardFocusManager 和焦点实现使用。一般客户端不能使用。
getGlobalCurrentFocusCycleRoot(),
setGlobalCurrentFocusCycleRoot(java.awt.Container)
protected Container getGlobalCurrentFocusCycleRoot()
throws SecurityException
如果此 KeyboardFocusManager 调用的不是线程上下文的当前 KeyboardFocusManager,则此方法将抛出 SecurityException。
SecurityException - 如果此 KeyboardFocusManager 调用的不是线程上下文的当前 KeyboardFocusManager
getCurrentFocusCycleRoot(),
setGlobalCurrentFocusCycleRoot(java.awt.Container)
public void setGlobalCurrentFocusCycleRoot(Container newFocusCycleRoot)
此方法仅供 KeyboardFocusManager 和焦点实现使用。一般客户端不能使用。
newFocusCycleRoot - 新焦点循环根
getCurrentFocusCycleRoot(),
getGlobalCurrentFocusCycleRoot()
public void addPropertyChangeListener(PropertyChangeListener listener)
listener - 要添加的 PropertyChangeListener
removePropertyChangeListener(java.beans.PropertyChangeListener),
getPropertyChangeListeners(),
addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
如果侦听器为 null,则不抛出异常,也不执行任何动作。
listener - 要移除的 PropertyChangeListener
addPropertyChangeListener(java.beans.PropertyChangeListener),
getPropertyChangeListeners(),
removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
public PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListener;如果目前没有注册任何属性更改侦听器,则返回空数组
addPropertyChangeListener(java.beans.PropertyChangeListener),
removePropertyChangeListener(java.beans.PropertyChangeListener),
getPropertyChangeListeners(java.lang.String)
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
propertyName - 上面列出的属性名之一
listener - 要添加的 PropertyChangeListener
addPropertyChangeListener(java.beans.PropertyChangeListener),
removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener),
getPropertyChangeListeners(java.lang.String)
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
如果侦听器为 null,则不抛出异常,也不执行任何动作。
propertyName - 有效属性名
listener - 要移除的 PropertyChangeListener
addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener),
getPropertyChangeListeners(java.lang.String),
removePropertyChangeListener(java.beans.PropertyChangeListener)
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
PropertyChangeListener 组成的数组。
PropertyChangeListener;如果没有添加过这样的侦听器,则返回空数组。
addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener),
removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
protected void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
propertyName - 已更改的属性名
oldValue - 属性的上一个值
newValue - 属性的新值
public void addVetoableChangeListener(VetoableChangeListener listener)
listener - 要添加的 VetoableChangeListener
removeVetoableChangeListener(java.beans.VetoableChangeListener),
getVetoableChangeListeners(),
addVetoableChangeListener(java.lang.String,java.beans.VetoableChangeListener)
public void removeVetoableChangeListener(VetoableChangeListener listener)
如果侦听器为 null,则不抛出异常,也不执行任何动作。
listener - 要移除的 VetoableChangeListener
addVetoableChangeListener(java.beans.VetoableChangeListener),
getVetoableChangeListeners(),
removeVetoableChangeListener(java.lang.String,java.beans.VetoableChangeListener)
public VetoableChangeListener[] getVetoableChangeListeners()
VetoableChangeListener;如果目前没有注册任何可否决更改侦听器,则返回空数组
addVetoableChangeListener(java.beans.VetoableChangeListener),
removeVetoableChangeListener(java.beans.VetoableChangeListener),
getVetoableChangeListeners(java.lang.String)
public void addVetoableChangeListener(String propertyName,
VetoableChangeListener listener)
propertyName - 上面列出的属性名之一
listener - 要添加的 VetoableChangeListener
addVetoableChangeListener(java.beans.VetoableChangeListener),
removeVetoableChangeListener(java.beans.VetoableChangeListener),
getVetoableChangeListeners()
public void removeVetoableChangeListener(String propertyName,
VetoableChangeListener listener)
如果侦听器为 null,则不抛出异常,也不执行任何动作。
propertyName - 有效属性名
listener - 要移除的 VetoableChangeListener
addVetoableChangeListener(java.beans.VetoableChangeListener),
getVetoableChangeListeners(),
removeVetoableChangeListener(java.beans.VetoableChangeListener)
public VetoableChangeListener[] getVetoableChangeListeners(String propertyName)
VetoableChangeListener 组成的数组。
VetoableChangeListener;如果没有添加过这样的侦听器,则返回空数组。
addVetoableChangeListener(java.lang.String,java.beans.VetoableChangeListener),
removeVetoableChangeListener(java.lang.String,java.beans.VetoableChangeListener),
getVetoableChangeListeners()
protected void fireVetoableChange(String propertyName,
Object oldValue,
Object newValue)
throws PropertyVetoException
propertyName - 已更改的属性名
oldValue - 属性以前的值
newValue - 属性的新值
PropertyVetoException - 如果
VetoableChangeListener 抛出了
PropertyVetoException
public void addKeyEventDispatcher(KeyEventDispatcher dispatcher)
dispatchKeyEvent 方法返回
true,通知就会暂停。可以添加的 KeyEventDispatcher 的总数没有限制,添加特定 KeyEventDispatcher 实例的次数也没有限制。
如果指定了 null 指派程序,则不执行动作也不抛出异常。
在多线程应用程序中,KeyEventDispatcher 的行为与其他 AWT 侦听器相同。有关更多详细信息,请参阅 AWT 线程问题。
dispatcher - 要添加到指派程序链的 KeyEventDispatcher
removeKeyEventDispatcher(java.awt.KeyEventDispatcher)
public void removeKeyEventDispatcher(KeyEventDispatcher dispatcher)
addKeyEventDispatcher 显式重新注册的。
如果指定了 null 调度程序,指定的调度程序没有位于调度程序链中,或者此 KeyboardFocusManager 不是通过显式重新注册指定的,则不执行动作也不抛出异常。
在多线程应用程序中,KeyEventDispatcher 的行为与其他 AWT 侦听器相同。有关更多详细信息,请参阅 AWT 线程问题。
dispatcher - 要从调度程序链中移除的 KeyEventDispatcher
addKeyEventDispatcher(java.awt.KeyEventDispatcher)
protected List<KeyEventDispatcher> getKeyEventDispatchers()
addKeyEventDispatcher 显式重新注册的。如果没有注册其他 KeyEventDispatcher,则实现随意返回 null 或长度为 0 的 List。客户端代码不应假定某种行为多于其他行为,也不应假定建立行为后不能更改。
addKeyEventDispatcher(java.awt.KeyEventDispatcher),
removeKeyEventDispatcher(java.awt.KeyEventDispatcher)
public void addKeyEventPostProcessor(KeyEventPostProcessor processor)
postProcessKeyEvent 方法返回
true,通知就会暂停。可以添加的 KeyEventPostProcessors 的总数没有限制,添加特定 KeyEventPostProcessor 实例的次数也没有限制。
如果指定了 null 后处理器,则不执行动作也不抛出异常。
在多线程应用程序中,KeyEventPostProcessor 的行为与其他 AWT 侦听器相同。有关更多详细信息,请参阅 AWT 线程问题。
processor - 要添加到后处理器链的 KeyEventPostProcessor
removeKeyEventPostProcessor(java.awt.KeyEventPostProcessor)
public void removeKeyEventPostProcessor(KeyEventPostProcessor processor)
addKeyEventPostProcessor 添加的其他引用。
如果指定了 null 后处理器,指定的后处理器没有位于后处理器链中,或者此 KeyboardFocusManager 不是通过显式添加指定的,则不执行动作也不抛出异常。
在多线程应用程序中,KeyEventPostProcessor 的行为与其他 AWT 侦听器相同。有关更多详细信息,请参阅 AWT 线程问题。
processor - 要从后处理器链中移除的 KeyEventPostProcessor
addKeyEventPostProcessor(java.awt.KeyEventPostProcessor)
protected List<KeyEventPostProcessor> getKeyEventPostProcessors()
addKeyEventPostProcessor 显式添加的。如果没有注册任何 KeyEventDispatcher,则实现随意返回 null 或长度为 0 的 List。客户端代码不应假定某种行为多于其他行为,也不应假定建立行为后不能更改。
addKeyEventPostProcessor(java.awt.KeyEventPostProcessor),
removeKeyEventPostProcessor(java.awt.KeyEventPostProcessor)
public abstract boolean dispatchEvent(AWTEvent e)
redispatchEvent 完成指派操作,以防 AWT 事件调度程序递归式请求 KeyboardFocusManager 再次指派该事件。如果此方法返回
false,则 AWT 事件调度程序将尝试指派该事件本身。
e - 要指派的 AWTEvent
true;否则返回
false
redispatchEvent(java.awt.Component, java.awt.AWTEvent),
dispatchKeyEvent(java.awt.event.KeyEvent)
public final void redispatchEvent(Component target,
AWTEvent e)
dispatchEvent 的客户端实现和客户端定义的 KeyEventDispatcher 必须调用
redispatchEvent(target, e) 而不是调用
target.dispatchEvent(e) 来指派事件。
此方法仅供 KeyboardFocusManager 和 KeyEventDispatcher 使用。一般客户端不能使用。
target - 应将事件指派到的 Component
e - 要指派的事件
dispatchEvent(java.awt.AWTEvent),
KeyEventDispatcher
public abstract boolean dispatchKeyEvent(KeyEvent e)
dispatchEvent 将调用此方法。如果此方法的实现返回
false,则
dispatchEvent 可能试图指派 KeyEvent 本身,或者可能简单地返回
false。如果返回
true,则
dispatchEvent 也应该返回
true。
KeyEventDispatcher 中的
dispatchKeyEvent
e - 当前 KeyboardFocusManager 已经请求此 KeyEventDispatcher 指派的 KeyEvent
true;否则,返回
false
dispatchEvent(java.awt.AWTEvent)
public abstract boolean postProcessKeyEvent(KeyEvent e)
dispatchKeyEvent 将调用此方法。默认情况下,此方法将通过使用该事件并激活快捷方式来处理映射到 AWT
MenuShortcut 的所有未使用的 KeyEvent。
KeyEventPostProcessor 中的
postProcessKeyEvent
e - 要后处理的 KeyEvent
true,指示任何其他 KeyEventPostProcessor 都将得不到该 KeyEvent 的通知。
dispatchKeyEvent(java.awt.event.KeyEvent),
MenuShortcut
public abstract void processKeyEvent(Component focusedComponent,
KeyEvent e)
focusedComponent - 指定的事件表示其焦点遍历键时,将成为焦点遍历操作基础的 Component
e - 可能表示焦点遍历键的事件
protected abstract void enqueueKeyEvents(long after,
Component untilFocused)
dequeueKeyEvents 或
discardKeyEvents 取消延迟请求以前,KeyboardFocusManager 负责延迟指派时间戳晚于指定时间戳的 KeyEvent。
after - 当前事件的时间戳,如果当前事件没有时间戳或者 AWT 无法确定目前正在处理哪个事件,则为当前系统时间
untilFocused - 挂起 KeyEvent 之前应该接收 FOCUS_GAINED 事件的 Component
dequeueKeyEvents(long, java.awt.Component),
discardKeyEvents(java.awt.Component)
protected abstract void dequeueKeyEvents(long after,
Component untilFocused)
enqueueKeyEvents 而加入队列的 KeyEvent,以将它们正常指派给当前焦点所有者。如果给定的时间戳小于零,则应该取消具有
oldest 时间戳的给定 Component 的未处理排队请求(如果有)。
after - 在对
enqueueKeyEvents 的调用中指定的时间戳,或者任何小于 0 的值
untilFocused - 在对
enqueueKeyEvents 的调用中指定的 Component
enqueueKeyEvents(long, java.awt.Component),
discardKeyEvents(java.awt.Component)
protected abstract void discardKeyEvents(Component comp)
enqueueKeyEvents 而加入队列 KeyEvent。
comp - 对
enqueueKeyEvents 的一次或多次调用中指定的 Component
enqueueKeyEvents(long, java.awt.Component),
dequeueKeyEvents(long, java.awt.Component)
public abstract void focusNextComponent(Component aComponent)
aComponent - 作为焦点遍历操作基础的 Component
FocusTraversalPolicy
public abstract void focusPreviousComponent(Component aComponent)
aComponent - 作为焦点遍历操作基础的 Component
FocusTraversalPolicy
public abstract void upFocusCycle(Component aComponent)
aComponent - 作为焦点遍历操作基础的 Component
public abstract void downFocusCycle(Container aContainer)
aContainer - 作为焦点遍历操作基础的 Container
public final void focusNextComponent()
public final void focusPreviousComponent()
public final void upFocusCycle()
public final void downFocusCycle()
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。