java.lang.Object | +--java.awt.KeyboardFocusManager | +--java.awt.DefaultKeyboardFocusManager
Unsafe: The default KeyboardFocusManager for AWT applications. Focus traversal is done in response to a Component's focus traversal keys, and using a Container's FocusTraversalPolicy.
FocusTraversalPolicy,
Component.setFocusTraversalKeys(int, java.util.Set),
Component.getFocusTraversalKeys(int)BACKWARD_TRAVERSAL_KEYS, DOWN_CYCLE_TRAVERSAL_KEYS, FORWARD_TRAVERSAL_KEYS, SNFH_FAILURE, SNFH_SUCCESS_HANDLED, SNFH_SUCCESS_PROCEED, TRAVERSAL_KEY_LENGTH, UP_CYCLE_TRAVERSAL_KEYS
DefaultKeyboardFocusManager()
protected void
dequeueKeyEvents(long after,
Component untilFocused)
enqueueKeyEvents with the same timestamp and Component.
protected void
discardKeyEvents(Component comp)
enqueueKeyEvents with the specified Component, or one of
its descendants.
boolean
dispatchEvent(AWTEvent e)
boolean
dispatchKeyEvent(KeyEvent e)
dispatchEvent if no other
KeyEventDispatcher in the dispatcher chain dispatched the KeyEvent, or
if no other KeyEventDispatchers are registered.
void
downFocusCycle(Container aContainer)
protected void
enqueueKeyEvents(long after,
Component untilFocused)
void
focusNextComponent(Component aComponent)
void
focusPreviousComponent(Component aComponent)
void
processKeyEvent(Component focusedComponent,
KeyEvent e)
private boolean
sendMessage(Component target,
AWTEvent e)
addKeyEventDispatcher, addKeyEventPostProcessor, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clearGlobalFocusOwner, clearMostRecentFocusOwner, downFocusCycle, firePropertyChange, fireVetoableChange, focusNextComponent, focusPreviousComponent, getActiveWindow, getCurrentFocusCycleRoot, getCurrentKeyboardFocusManager, getCurrentKeyboardFocusManager, getCurrentWaitingRequest, getDefaultFocusTraversalKeys, getDefaultFocusTraversalPolicy, getFocusedWindow, getFocusOwner, getGlobalActiveWindow, getGlobalCurrentFocusCycleRoot, getGlobalFocusedWindow, getGlobalFocusOwner, getGlobalPermanentFocusOwner, getKeyEventDispatchers, getKeyEventPostProcessors, getMostRecentFocusOwner, getNativeFocusedWindow, getNativeFocusOwner, getPermanentFocusOwner, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, heavyweightButtonDown, heavyweightButtonDown, isProxyActive, loadFocusTraversalKeys, markClearGlobalFocusOwner, processSynchronousLightweightTransfer, redispatchEvent, removeFirstRequest, removeFocusRequest, removeKeyEventDispatcher, removeKeyEventPostProcessor, removeLastFocusRequest, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, requestCount, retargetFocusEvent, setCurrentKeyboardFocusManager, setDefaultFocusTraversalKeys, setDefaultFocusTraversalPolicy, setGlobalActiveWindow, setGlobalCurrentFocusCycleRoot, setGlobalFocusedWindow, setGlobalFocusOwner, setGlobalPermanentFocusOwner, setMostRecentFocusOwner, setMostRecentFocusOwner, shouldNativelyFocusHeavyweight, upFocusCycle
private Window realOppositeWindow
private Component realOppositeComponent
private int inSendMessage
private LinkedList enqueuedKeyEvents
private LinkedList typeAheadMarkers
private boolean consumeNextKeyTyped
public DefaultKeyboardFocusManager()
private Window getOwningFrameDialog(Window window)
private void restoreFocus(FocusEvent fe, Window newFocusedWindow)
private void restoreFocus(WindowEvent we)
private boolean restoreFocus(Window aWindow, Component vetoedComponent, boolean clearOnFailure)
private boolean restoreFocus(Component toFocus, boolean clearOnFailure)
private boolean sendMessage(Component target, AWTEvent e)
public boolean dispatchEvent(AWTEvent e)
false, then the AWT event
dispatcher will attempt to dispatch the event itself.
dispatchEvent in class KeyboardFocusManagere - the AWTEvent to be dispatched
true if this method dispatched the event;
false otherwiseKeyboardFocusManager.redispatchEvent(java.awt.Component, java.awt.AWTEvent),
KeyboardFocusManager.dispatchKeyEvent(java.awt.event.KeyEvent)public boolean dispatchKeyEvent(KeyEvent e)
dispatchEvent if no other
KeyEventDispatcher in the dispatcher chain dispatched the KeyEvent, or
if no other KeyEventDispatchers are registered. If the event has not
been consumed, its target is enabled, and the focus owner is not null,
this method dispatches the event to its target. This method will also
subsequently dispatch the event to all registered
KeyEventPostProcessors.
In all cases, this method returns true, since
DefaultKeyboardFocusManager is designed so that neither
dispatchEvent, nor the AWT event dispatcher, should take
further action on the event in any situation.
dispatchKeyEvent in interface KeyEventDispatcherdispatchKeyEvent in class KeyboardFocusManagere - the KeyEvent to be dispatched
trueComponent.dispatchEvent(java.awt.AWTEvent)public boolean postProcessKeyEvent(KeyEvent e)
dispatchKeyEvent. It will
handle any unconsumed KeyEvents that map to an AWT
MenuShortcut by consuming the event and activating the
shortcut.
postProcessKeyEvent in interface KeyEventPostProcessorpostProcessKeyEvent in class KeyboardFocusManagere - the KeyEvent to post-process
truedispatchKeyEvent(java.awt.event.KeyEvent),
MenuShortcutprivate void pumpApprovedKeyEvents()
private boolean typeAheadAssertions(Component target, AWTEvent e)
private boolean preDispatchKeyEvent(KeyEvent ke)
public void processKeyEvent(Component focusedComponent, KeyEvent e)
processKeyEvent in class KeyboardFocusManagerfocusedComponent - the Component that is the basis for a focus
traversal operation if the specified event represents a focus
traversal key for the Componente - the event that may represent a focus traversal keyprotected void enqueueKeyEvents(long after, Component untilFocused)
dequeueKeyEvents or discardKeyEvents.
enqueueKeyEvents in class KeyboardFocusManagerafter - timestamp of current event, or the current, system time if
the current event has no timestamp, or the AWT cannot determine
which event is currently being handleduntilFocused - Component which will receive a FOCUS_GAINED event
before any pending KeyEventsdequeueKeyEvents(long, java.awt.Component),
discardKeyEvents(java.awt.Component)protected void dequeueKeyEvents(long after, Component untilFocused)
enqueueKeyEvents with the same timestamp and Component.
If the given timestamp is less than zero, the outstanding enqueue
request for the given Component with the oldest timestamp (if
any) should be cancelled.
dequeueKeyEvents in class KeyboardFocusManagerafter - the timestamp specified in the call to
enqueueKeyEvents, or any value < 0untilFocused - the Component specified in the call to
enqueueKeyEventsenqueueKeyEvents(long, java.awt.Component),
discardKeyEvents(java.awt.Component)protected void discardKeyEvents(Component comp)
enqueueKeyEvents with the specified Component, or one of
its descendants.
discardKeyEvents in class KeyboardFocusManagercomp - the Component specified in one or more calls to
enqueueKeyEvents, or a parent of such a ComponentenqueueKeyEvents(long, java.awt.Component),
dequeueKeyEvents(long, java.awt.Component)private void purgeStampedEvents(long start, long end)
public void focusPreviousComponent(Component aComponent)
focusPreviousComponent in class KeyboardFocusManageraComponent - the Component that is the basis for the focus
traversal operationFocusTraversalPolicy,
Component.transferFocusBackward()public void focusNextComponent(Component aComponent)
focusNextComponent in class KeyboardFocusManageraComponent - the Component that is the basis for the focus
traversal operationFocusTraversalPolicy,
Component.transferFocus()public void upFocusCycle(Component aComponent)
upFocusCycle in class KeyboardFocusManageraComponent - the Component that is the basis for the focus
traversal operationComponent.transferFocusUpCycle()public void downFocusCycle(Container aContainer)
downFocusCycle in class KeyboardFocusManagerContainer.transferFocusDownCycle()