public class DefaultKeyboardFocusManager extends KeyboardFocusManager
请参阅How to Use the Focus Subsystem ,在Java教程一节,以及Focus Specification以获取更多信息。
BACKWARD_TRAVERSAL_KEYS, DOWN_CYCLE_TRAVERSAL_KEYS, FORWARD_TRAVERSAL_KEYS, UP_CYCLE_TRAVERSAL_KEYS
Constructor and Description |
---|
DefaultKeyboardFocusManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
dequeueKeyEvents(long after, Component untilFocused)
新闻稿正常指派到当前焦点所有者这是因为排队到呼叫的所有KeyEvent
enqueueKeyEvents 相同的时间戳和组件。
|
protected void |
discardKeyEvents(Component comp)
丢弃由于一个或多个调用
enqueueKeyEvents 与指定的组件或其后代排队的所有KeyEvent。
|
boolean |
dispatchEvent(AWTEvent e)
该方法由AWT事件调度程序调用,请求当前的KeyboardFocusManager代表它发送指定的事件。
|
boolean |
dispatchKeyEvent(KeyEvent e)
通过调用
dispatchEvent 如果调度程序链中没有其他的KeyEventDispatcher调度KeyEvent,或者没有注册其他KeyEventDispatcher。
|
void |
downFocusCycle(Container aContainer)
将焦点向下移动一个焦点遍历周期。
|
protected void |
enqueueKeyEvents(long after, Component untilFocused)
延迟调度KeyEvents直到指定的Component成为焦点所有者。
|
void |
focusNextComponent(Component aComponent)
将组件聚焦在aComponent之后,通常基于FocusTraversalPolicy。
|
void |
focusPreviousComponent(Component aComponent)
在组件之前聚焦组件,通常基于FocusTraversalPolicy。
|
boolean |
postProcessKeyEvent(KeyEvent e)
此方法将由
dispatchKeyEvent 。
|
void |
processKeyEvent(Component focusedComponent, KeyEvent e)
当且仅当KeyEvent表示指定的focusComponent的焦点遍历键时,此方法启动焦点遍历操作。
|
void |
upFocusCycle(Component aComponent)
将焦点移动到一个焦点遍历周期。
|
addKeyEventDispatcher, addKeyEventPostProcessor, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clearFocusOwner, clearGlobalFocusOwner, downFocusCycle, firePropertyChange, fireVetoableChange, focusNextComponent, focusPreviousComponent, getActiveWindow, getCurrentFocusCycleRoot, getCurrentKeyboardFocusManager, getDefaultFocusTraversalKeys, getDefaultFocusTraversalPolicy, getFocusedWindow, getFocusOwner, getGlobalActiveWindow, getGlobalCurrentFocusCycleRoot, getGlobalFocusedWindow, getGlobalFocusOwner, getGlobalPermanentFocusOwner, getKeyEventDispatchers, getKeyEventPostProcessors, getPermanentFocusOwner, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, redispatchEvent, removeKeyEventDispatcher, removeKeyEventPostProcessor, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setCurrentKeyboardFocusManager, setDefaultFocusTraversalKeys, setDefaultFocusTraversalPolicy, setGlobalActiveWindow, setGlobalCurrentFocusCycleRoot, setGlobalFocusedWindow, setGlobalFocusOwner, setGlobalPermanentFocusOwner, upFocusCycle
public boolean dispatchEvent(AWTEvent e)
false
,则AWT事件调度程序将尝试调度事件本身。
dispatchEvent
在类别
KeyboardFocusManager
e
- 要发送的AWTEvent
true
如果此方法调度事件;
false
否则
KeyboardFocusManager.redispatchEvent(java.awt.Component, java.awt.AWTEvent)
,
KeyboardFocusManager.dispatchKeyEvent(java.awt.event.KeyEvent)
public boolean dispatchKeyEvent(KeyEvent e)
dispatchEvent
如果调度程序链中没有其他的KeyEventDispatcher调度KeyEvent,或者没有注册其他KeyEventDispatcher。
如果事件尚未消耗,则其目标将被启用,并且焦点所有者不为空,此方法将事件分派到其目标。
此方法还将随后将事件发送到所有注册的KeyEventPostProcessors。
所有这些操作完成后,事件将传递给对等体进行处理。
在所有情况下,此方法返回true
,因为DefaultKeyboardFocusManager旨在使dispatchEvent
和AWT事件调度程序都不dispatchEvent
任何情况下的事件采取进一步措施。
dispatchKeyEvent
在界面
KeyEventDispatcher
dispatchKeyEvent
在类别
KeyboardFocusManager
e
- 要发送的KeyEvent
true
Component.dispatchEvent(java.awt.AWTEvent)
public boolean postProcessKeyEvent(KeyEvent e)
dispatchKeyEvent
。
它将通过消耗事件并激活快捷方式来处理映射到AWT MenuShortcut
的任何未消耗的KeyEvents。
postProcessKeyEvent
在界面
KeyEventPostProcessor
postProcessKeyEvent
在类别
KeyboardFocusManager
e
- 后期处理的KeyEvent
true
dispatchKeyEvent(java.awt.event.KeyEvent)
, MenuShortcut
public void processKeyEvent(Component focusedComponent, KeyEvent e)
processKeyEvent
在类别
KeyboardFocusManager
focusedComponent
- 作为聚焦遍历操作的基础的组件,如果指定的事件表示组件的焦点遍历键
e
- 可能代表焦点遍历键的事件
protected void enqueueKeyEvents(long after, Component untilFocused)
dequeueKeyEvents
或discardKeyEvents
取消延迟请求。
enqueueKeyEvents
在类别
KeyboardFocusManager
after
- 当前事件的时间戳,或当前事件没有时间戳的当前系统时间,或AWT无法确定当前处理的事件
untilFocused
- 将在任何待处理的KeyEvent之前收到FOCUS_GAINED事件的组件
dequeueKeyEvents(long, java.awt.Component)
,
discardKeyEvents(java.awt.Component)
protected void dequeueKeyEvents(long after, Component untilFocused)
enqueueKeyEvents
相同的时间戳和组件。
如果给定的时间戳小于零,则应取消给具有最早时间戳(如果有)的给定组件的未完成的入队请求。
dequeueKeyEvents
在
KeyboardFocusManager
after
- 在调用enqueueKeyEvents中指定的
enqueueKeyEvents
,或任何值<0
untilFocused
- 在调用enqueueKeyEvents中指定的
enqueueKeyEvents
enqueueKeyEvents(long, java.awt.Component)
,
discardKeyEvents(java.awt.Component)
protected void discardKeyEvents(Component comp)
enqueueKeyEvents
或其后代的enqueueKeyEvents而排入队列的所有KeyEvent。
discardKeyEvents
在类别
KeyboardFocusManager
comp
- 在一次或多次调用
enqueueKeyEvents
,或此类组件的父级
enqueueKeyEvents(long, java.awt.Component)
,
dequeueKeyEvents(long, java.awt.Component)
public void focusPreviousComponent(Component aComponent)
focusPreviousComponent
在
KeyboardFocusManager
aComponent
- 作为焦点遍历操作的基础的组件
FocusTraversalPolicy
, Component.transferFocusBackward()
public void focusNextComponent(Component aComponent)
focusNextComponent
在类别
KeyboardFocusManager
aComponent
- 作为焦点遍历操作的基础的组件
FocusTraversalPolicy
, Component.transferFocus()
public void upFocusCycle(Component aComponent)
upFocusCycle
在类别
KeyboardFocusManager
aComponent
- 作为焦点遍历操作的基础的组件
Component.transferFocusUpCycle()
public void downFocusCycle(Container aContainer)
downFocusCycle
在类别
KeyboardFocusManager
aContainer
- 作为焦点遍历操作的基础的容器
Container.transferFocusDownCycle()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.