Note that KeyboardFocusManager itself implements KeyEventDispatcher. By default, the current KeyboardFocusManager will be the sink for all KeyEvents not dispatched by the registered KeyEventDispatchers. The current KeyboardFocusManager cannot be completely deregistered as a KeyEventDispatcher. However, if a KeyEventDispatcher reports that it dispatched the KeyEvent, regardless of whether it actually did so, the KeyboardFocusManager will take no further action with regard to the KeyEvent. (While it is possible for client code to register the current KeyboardFocusManager as a KeyEventDispatcher one or more times, this is usually unnecessary and not recommended.)
KeyboardFocusManager#addKeyEventDispatcher, KeyboardFocusManager#removeKeyEventDispatcher
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the KeyboardFocusManager should take no
further action with regard to the KeyEvent; false
otherwisethe KeyEvent to dispatch e)This method is called by the current KeyboardFocusManager requesting that this KeyEventDispatcher dispatch the specified event on its behalf. |
| dispatchKeyEvent | back to summary |
|---|---|
| public boolean dispatchKeyEvent(KeyEvent e) This method is called by the current KeyboardFocusManager requesting
that this KeyEventDispatcher dispatch the specified event on its behalf.
This KeyEventDispatcher is free to retarget the event, consume it,
dispatch it itself, or make other changes. This capability is typically
used to deliver KeyEvents to Components other than the focus owner. This
can be useful when navigating children of non-focusable Windows in an
accessible environment, for example. Note that if a KeyEventDispatcher
dispatches the KeyEvent itself, it must use
If an implementation of this method returns
| |