Module java.desktop
Package java.awt

Interface KeyEventDispatcher

All Known Implementing Classes:
DefaultFocusManager, DefaultKeyboardFocusManager, FocusManager, KeyboardFocusManager
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface KeyEventDispatcher
A KeyEventDispatcher cooperates with the current KeyboardFocusManager in the targeting and dispatching of all KeyEvents. KeyEventDispatchers registered with the current KeyboardFocusManager will receive KeyEvents before they are dispatched to their targets, allowing each KeyEventDispatcher to retarget the event, consume it, dispatch the event itself, or make other changes.

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.)

Since:
1.4
See Also: