< prev index next >

src/java.desktop/share/classes/java/awt/KeyEventPostProcessor.java

Print this page




  51  * @author David Mendenhall
  52  *
  53  * @see KeyboardFocusManager#addKeyEventPostProcessor
  54  * @see KeyboardFocusManager#removeKeyEventPostProcessor
  55  * @since 1.4
  56  */
  57 @FunctionalInterface
  58 public interface KeyEventPostProcessor {
  59 
  60     /**
  61      * This method is called by the current KeyboardFocusManager, requesting
  62      * that this KeyEventPostProcessor perform any necessary post-processing
  63      * which should be part of the KeyEvent's final resolution. At the time
  64      * this method is invoked, typically the KeyEvent has already been
  65      * dispatched to and handled by its target. However, if no Component in
  66      * the application currently owns the focus, then the KeyEvent has not
  67      * been dispatched to any Component. Typically, KeyEvent post-processing
  68      * will be used to implement features which require global KeyEvent
  69      * post-handling, such as menu shortcuts. Note that if a
  70      * KeyEventPostProcessor wishes to dispatch the KeyEvent, it must use
  71      * <code>redispatchEvent</code> to prevent the AWT from recursively
  72      * requesting that this KeyEventPostProcessor perform post-processing
  73      * of the event again.
  74      * <p>
  75      * If an implementation of this method returns <code>false</code>, then the
  76      * KeyEvent is passed to the next KeyEventPostProcessor in the chain,
  77      * ending with the current KeyboardFocusManager. If an implementation
  78      * returns <code>true</code>, the KeyEvent is assumed to have been fully
  79      * handled (although this need not be the case), and the AWT will take no
  80      * further action with regard to the KeyEvent. If an implementation
  81      * consumes the KeyEvent but returns <code>false</code>, the consumed
  82      * event will still be passed to the next KeyEventPostProcessor in the
  83      * chain. It is important for developers to check whether the KeyEvent has
  84      * been consumed before performing any post-processing of the KeyEvent. By
  85      * default, the current KeyboardFocusManager will perform no post-
  86      * processing in response to a consumed KeyEvent.
  87      *
  88      * @param e the KeyEvent to post-process
  89      * @return <code>true</code> if the AWT should take no further action with
  90      *         regard to the KeyEvent; <code>false</code> otherwise
  91      * @see KeyboardFocusManager#redispatchEvent
  92      */
  93     boolean postProcessKeyEvent(KeyEvent e);
  94 }


  51  * @author David Mendenhall
  52  *
  53  * @see KeyboardFocusManager#addKeyEventPostProcessor
  54  * @see KeyboardFocusManager#removeKeyEventPostProcessor
  55  * @since 1.4
  56  */
  57 @FunctionalInterface
  58 public interface KeyEventPostProcessor {
  59 
  60     /**
  61      * This method is called by the current KeyboardFocusManager, requesting
  62      * that this KeyEventPostProcessor perform any necessary post-processing
  63      * which should be part of the KeyEvent's final resolution. At the time
  64      * this method is invoked, typically the KeyEvent has already been
  65      * dispatched to and handled by its target. However, if no Component in
  66      * the application currently owns the focus, then the KeyEvent has not
  67      * been dispatched to any Component. Typically, KeyEvent post-processing
  68      * will be used to implement features which require global KeyEvent
  69      * post-handling, such as menu shortcuts. Note that if a
  70      * KeyEventPostProcessor wishes to dispatch the KeyEvent, it must use
  71      * {@code redispatchEvent} to prevent the AWT from recursively
  72      * requesting that this KeyEventPostProcessor perform post-processing
  73      * of the event again.
  74      * <p>
  75      * If an implementation of this method returns {@code false}, then the
  76      * KeyEvent is passed to the next KeyEventPostProcessor in the chain,
  77      * ending with the current KeyboardFocusManager. If an implementation
  78      * returns {@code true}, the KeyEvent is assumed to have been fully
  79      * handled (although this need not be the case), and the AWT will take no
  80      * further action with regard to the KeyEvent. If an implementation
  81      * consumes the KeyEvent but returns {@code false}, the consumed
  82      * event will still be passed to the next KeyEventPostProcessor in the
  83      * chain. It is important for developers to check whether the KeyEvent has
  84      * been consumed before performing any post-processing of the KeyEvent. By
  85      * default, the current KeyboardFocusManager will perform no post-
  86      * processing in response to a consumed KeyEvent.
  87      *
  88      * @param e the KeyEvent to post-process
  89      * @return {@code true} if the AWT should take no further action with
  90      *         regard to the KeyEvent; {@code false} otherwise
  91      * @see KeyboardFocusManager#redispatchEvent
  92      */
  93     boolean postProcessKeyEvent(KeyEvent e);
  94 }
< prev index next >