@FunctionalInterface public interface KeyEventPostProcessor
Note that the KeyboardFocusManager itself implements KeyEventPostProcessor. By default, the current KeyboardFocusManager will be the final KeyEventPostProcessor in the chain. The current KeyboardFocusManager cannot be completely deregistered as a KeyEventPostProcessor. However, if a KeyEventPostProcessor reports that no further post-processing of the KeyEvent should take place, the AWT will consider the event fully handled and will take no additional action with regard to the event. (While it is possible for client code to register the current KeyboardFocusManager as a KeyEventPostProcessor one or more times, this is usually unnecessary and not recommended.)
Modifier and Type | Method and Description |
---|---|
boolean |
postProcessKeyEvent(KeyEvent e)
This method is called by the current KeyboardFocusManager, requesting
that this KeyEventPostProcessor perform any necessary post-processing
which should be part of the KeyEvent's final resolution.
|
boolean postProcessKeyEvent(KeyEvent e)
redispatchEvent
to prevent the AWT from recursively
requesting that this KeyEventPostProcessor perform post-processing
of the event again.
If an implementation of this method returns false
, then the
KeyEvent is passed to the next KeyEventPostProcessor in the chain,
ending with the current KeyboardFocusManager. If an implementation
returns true
, the KeyEvent is assumed to have been fully
handled (although this need not be the case), and the AWT will take no
further action with regard to the KeyEvent. If an implementation
consumes the KeyEvent but returns false
, the consumed
event will still be passed to the next KeyEventPostProcessor in the
chain. It is important for developers to check whether the KeyEvent has
been consumed before performing any post-processing of the KeyEvent. By
default, the current KeyboardFocusManager will perform no post-
processing in response to a consumed KeyEvent.
e
- the KeyEvent to post-processtrue
if the AWT should take no further action with
regard to the KeyEvent; false
otherwiseKeyboardFocusManager.redispatchEvent(java.awt.Component, java.awt.AWTEvent)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.