java.awt

Interface KeyEventPostProcessor

public interface KeyEventPostProcessor

An instance of this interface coordinates with a KeyboardFocusManager to target and dispatch all key events that are otherwise unconsumed. This allows events which take place when nothing has focus to still operate, such as menu keyboard shortcuts.

By default, the KeyboardFocusManager is the sink for all key events not post-processed elsewhere. Therefore, it is unnecessary for the user to register the focus manager as a dispatcher.

Since: 1.4

See Also: addKeyEventPostProcessor removeKeyEventPostProcessor

UNKNOWN: updated to 1.4

Method Summary
booleanpostProcessKeyEvent(KeyEvent e)
Called by the KeyboardFocusManager to request that a key event be post-processed.

Method Detail

postProcessKeyEvent

public boolean postProcessKeyEvent(KeyEvent e)
Called by the KeyboardFocusManager to request that a key event be post-processed. Typically, the event has already been dispatched and handled, unless no object has focus. Thus, this allows global event handling for things like menu shortcuts. If this post-processor chooses to dispatch the event, it should call redispatchEvent to avoid infinite recursion.

If the return value is false, the KeyEvent is passed to the next dispatcher in the chain, ending with the KeyboardFocusManager. If the return value is true, the event has been consumed (although it might have been ignored), and no further action will be taken on the event. Be sure to check whether the event was consumed before dispatching it further.

Parameters: e the key event

Returns: true if the event has been consumed

See Also: KeyboardFocusManager