Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt
Interface KeyEventDispatcher  view KeyEventDispatcher download KeyEventDispatcher.java

All Known Implementing Classes:
KeyboardFocusManager

public interface KeyEventDispatcher

An instance of this interface coordinates with a KeyboardFocusManager to target and dispatch all key events. This allows retargeting, consuming, changing, or otherwise manipulating the key event before sending it on to a target.

By default, the KeyboardFocusManager is the sink for all key events not dispatched by other dispatchers. Therefore, it is unnecessary for the user to register the focus manager as a dispatcher.

Since:
1.4

Method Summary
 boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
          Called by the KeyboardFocusManager to request that a key event be dispatched.
 

Method Detail

dispatchKeyEvent

public boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
Called by the KeyboardFocusManager to request that a key event be dispatched. The dispatcher is free to retarget the event, consume it, dispatch it, or make other changes. This is usually done to allow delivery of key events to objects other than the window in focus, such as for navigating non-focusable components. If this dispatcher chooses to dispatch the event itself, 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.