java.awt
public class DefaultKeyboardFocusManager extends KeyboardFocusManager
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)
Removes the key event block specified by the supplied timestamp and component.
|
protected void |
discardKeyEvents(Component comp)
Discards all key event blocks relating to focus requirements for
the supplied component, regardless of timestamp.
|
boolean |
dispatchEvent(AWTEvent e)
The AWT event dispatcher uses this method to request that the manager
handle a particular event.
|
boolean |
dispatchKeyEvent(KeyEvent e)
Attempts to dispatch key events for which no key event dispatcher
has so far succeeded.
|
void |
downFocusCycle(Container cont)
Moves the current focus downwards by one focus cycle.
|
protected void |
enqueueKeyEvents(long after,
Component untilFocused)
Delays all key events following the specified timestamp until the
supplied component has focus.
|
void |
focusNextComponent(Component comp)
Moves the current focus to the next component following
comp, based on the current focus traversal policy.
|
void |
focusPreviousComponent(Component comp)
Moves the current focus to the previous component, prior to
comp, based on the current focus traversal policy.
|
boolean |
postProcessKeyEvent(KeyEvent e)
Handles the post processing of key events.
|
void |
processKeyEvent(Component comp,
KeyEvent e)
Handles focus traversal operations for key events which
represent focus traversal keys in relation to the supplied
component.
|
void |
upFocusCycle(Component comp)
Moves the current focus upwards by one focus cycle.
|
addKeyEventDispatcher, addKeyEventPostProcessor, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, 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 DefaultKeyboardFocusManager()
public boolean dispatchEvent(AWTEvent e)
KeyboardFocusManager
FocusEvent
s
and KeyEvent
s, and WindowEvent
s
relating to the focus. Dispatch is done with regard to the
the focus owner and the currently focused and active windows.
In handling the event, the source of the event may be overridden.
redispatchEvent()
. This avoids the infinite recursion
of dispatch requests which may occur if this method is called on
the target component.dispatchEvent
in class KeyboardFocusManager
e
- the event to dispatch.KeyboardFocusManager.redispatchEvent(java.awt.Component, java.awt.AWTEvent)
,
KeyEvent
,
FocusEvent
,
WindowEvent
public boolean dispatchKeyEvent(KeyEvent e)
KeyboardFocusManager
dispatchEvent()
following the sending of the key
event to any registered key event dispatchers. If the key
event reaches this stage, none of the dispatchers returned
true. This is, of course, always the case if there are no
registered dispatchers.
dispatchEvent()
, the calling method may try
to handle the event itself or simply forward on the
false result to its caller. When the event is dispatched
by this method, a true result is propogated through the
calling methods.dispatchKeyEvent
in interface KeyEventDispatcher
dispatchKeyEvent
in class KeyboardFocusManager
e
- the key event to dispatch.KeyboardFocusManager.redispatchEvent(Component, AWTEvent)
public boolean postProcessKeyEvent(KeyEvent e)
KeyboardFocusManager
MenuShortcut
s. The event is consumed
in the process and the shortcut is activated. This
method is usually called by dispatchKeyEvent
.postProcessKeyEvent
in interface KeyEventPostProcessor
postProcessKeyEvent
in class KeyboardFocusManager
e
- the key event to post process.KeyboardFocusManager.redispatchEvent(Component, AWTEvent)
public void processKeyEvent(Component comp, KeyEvent e)
KeyboardFocusManager
processKeyEvent
in class KeyboardFocusManager
comp
- the component on which to perform focus traversal,
on the assumption that this component has the focus.e
- the possible focus traversal key event.protected void enqueueKeyEvents(long after, Component untilFocused)
KeyboardFocusManager
FOCUS_GAINED
event is received
for the untilFocused component. The manager is responsible for ensuring
this takes place.enqueueKeyEvents
in class KeyboardFocusManager
after
- the timestamp beyond which all key events are delayed until
the supplied component gains focus.untilFocused
- the component to wait on gaining focus.protected void dequeueKeyEvents(long after, Component untilFocused)
KeyboardFocusManager
dequeueKeyEvents
in class KeyboardFocusManager
after
- the timestamp of the key event block to be removed, or a
value smaller than 0 if the oldest is to be removed.untilFocused
- the component of the key event block to be removed.protected void discardKeyEvents(Component comp)
KeyboardFocusManager
discardKeyEvents
in class KeyboardFocusManager
comp
- the component of the key event block(s) to be removed.public void focusPreviousComponent(Component comp)
KeyboardFocusManager
Canvas
es, Panel
s,
Label
s, ScrollPane
s, Scrollbar
s,
Window
s and lightweight components are judged
to be unacceptable by default. See the
DefaultFocusTraversalPolicy
for more details.focusPreviousComponent
in class KeyboardFocusManager
comp
- the component following the one which will
become the focus, following execution of this method.DefaultFocusTraversalPolicy
public void focusNextComponent(Component comp)
KeyboardFocusManager
Canvas
es, Panel
s,
Label
s, ScrollPane
s, Scrollbar
s,
Window
s and lightweight components are judged
to be unacceptable by default. See the
DefaultFocusTraversalPolicy
for more details.focusNextComponent
in class KeyboardFocusManager
comp
- the component prior to the one which will
become the focus, following execution of this method.DefaultFocusTraversalPolicy
public void upFocusCycle(Component comp)
KeyboardFocusManager
Window
, the default
focus component becomes the focus owner and the focus cycle
root is not changed.upFocusCycle
in class KeyboardFocusManager
comp
- the component used as part of the focus traversal.public void downFocusCycle(Container cont)
KeyboardFocusManager
downFocusCycle
in class KeyboardFocusManager
cont
- the container used as part of the focus traversal.