-
- All Known Implementing Classes:
- DefaultFocusManager, DefaultKeyboardFocusManager, FocusManager, KeyboardFocusManager
public interface KeyEventPostProcessor
A KeyEventPostProcessor cooperates with the current KeyboardFocusManager in the final resolution of all unconsumed KeyEvents. KeyEventPostProcessors registered with the current KeyboardFocusManager will receive KeyEvents after the KeyEvents have been dispatched to and handled by their targets. KeyEvents that would have been otherwise discarded because no Component in the application currently owns the focus will also be forwarded to registered KeyEventPostProcessors. This will allow applications to implement features that require global KeyEvent post-handling, such as menu shortcuts.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.)
-
-
Method Summary
Methods 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.
-
-
-
Method Detail
-
postProcessKeyEvent
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. At the time this method is invoked, typically the KeyEvent has already been dispatched to and handled by its target. However, if no Component in the application currently owns the focus, then the KeyEvent has not been dispatched to any Component. Typically, KeyEvent post-processing will be used to implement features which require global KeyEvent post-handling, such as menu shortcuts. Note that if a KeyEventPostProcessor wishes to dispatch the KeyEvent, it must useredispatchEvent
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 returnstrue
, 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 returnsfalse
, 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.- Parameters:
e
- the KeyEvent to post-process- Returns:
true
if the AWT should take no further action with regard to the KeyEvent;false
otherwise- See Also:
KeyboardFocusManager.redispatchEvent(java.awt.Component, java.awt.AWTEvent)
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
05/11/2024 17:25:49 Cette version de la page est en cache (à la date du 05/11/2024 17:25:49) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 31/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/awt/KeyEventPostProcessor.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.