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

Quick Search    Search Deep

java.awt
Class DefaultKeyboardFocusManager  view DefaultKeyboardFocusManager download DefaultKeyboardFocusManager.java

java.lang.Object
  extended byjava.awt.KeyboardFocusManager
      extended byjava.awt.DefaultKeyboardFocusManager
All Implemented Interfaces:
KeyEventDispatcher, KeyEventPostProcessor

public class DefaultKeyboardFocusManager
extends KeyboardFocusManager


Nested Class Summary
private  class DefaultKeyboardFocusManager.EventDelayRequest
          This class models a request to delay the dispatch of events that arrive after a certain time, until a certain component becomes the focus owner.
 
Field Summary
private  java.util.SortedSet delayRequests
          The java.util.SortedSet of current DefaultKeyboardFocusManager.EventDelayRequests.
private  AWTKeyStroke waitForKeyStroke
          This flag indicates for which focus traversal key release event we possibly wait, before letting any more KEY_TYPED events through.
 
Fields inherited from class java.awt.KeyboardFocusManager
BACKWARD_TRAVERSAL_KEYS, DOWN_CYCLE_TRAVERSAL_KEYS, FORWARD_TRAVERSAL_KEYS, UP_CYCLE_TRAVERSAL_KEYS
 
Constructor Summary
DefaultKeyboardFocusManager()
           
 
Method Summary
protected  void dequeueKeyEvents(long after, Component untilFocused)
          Removes the key event block specified by the supplied timestamp and component.
protected  void discardKeyEvents(Component comp)
          Discards all key event blocks relating to focus requirements for the supplied component, regardless of timestamp.
 boolean dispatchEvent(AWTEvent e)
          The AWT event dispatcher uses this method to request that the manager handle a particular event.
 boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
          Attempts to dispatch key events for which no key event dispatcher has so far succeeded.
 void downFocusCycle(Container cont)
          Moves the current focus downwards by one focus cycle.
private  boolean enqueueKeyEvent(java.awt.event.KeyEvent e)
           
protected  void enqueueKeyEvents(long after, Component untilFocused)
          Delays all key events following the specified timestamp until the supplied component has focus.
 void focusNextComponent(Component comp)
          Moves the current focus to the next component following comp, based on the current focus traversal policy.
 void focusPreviousComponent(Component comp)
          Moves the current focus to the previous component, prior to comp, based on the current focus traversal policy.
 boolean postProcessKeyEvent(java.awt.event.KeyEvent e)
          Handles the post processing of key events.
 void processKeyEvent(Component comp, java.awt.event.KeyEvent e)
          Handles focus traversal operations for key events which represent focus traversal keys in relation to the supplied component.
 void upFocusCycle(Component comp)
          Moves the current focus upwards by one focus cycle.
 
Methods inherited from class java.awt.KeyboardFocusManager
addKeyEventDispatcher, addKeyEventPostProcessor, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clearGlobalFocusOwner, downFocusCycle, firePropertyChange, fireVetoableChange, focusNextComponent, focusPreviousComponent, getActiveWindow, getCurrentFocusCycleRoot, getCurrentKeyboardFocusManager, getDefaultFocusTraversalKeys, getDefaultFocusTraversalPolicy, getFocusedWindow, getFocusOwner, getGlobalActiveWindow, getGlobalCurrentFocusCycleRoot, getGlobalFocusedWindow, getGlobalFocusOwner, getGlobalPermanentFocusOwner, getKeyEventDispatchers, getKeyEventPostProcessors, getPermanentFocusOwner, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, redispatchEvent, removeKeyEventDispatcher, removeKeyEventPostProcessor, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setCurrentKeyboardFocusManager, setDefaultFocusTraversalKeys, setDefaultFocusTraversalPolicy, setGlobalActiveWindow, setGlobalCurrentFocusCycleRoot, setGlobalFocusedWindow, setGlobalFocusOwner, setGlobalPermanentFocusOwner, upFocusCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

waitForKeyStroke

private AWTKeyStroke waitForKeyStroke
This flag indicates for which focus traversal key release event we possibly wait, before letting any more KEY_TYPED events through.


delayRequests

private java.util.SortedSet delayRequests
The java.util.SortedSet of current DefaultKeyboardFocusManager.EventDelayRequests.

Constructor Detail

DefaultKeyboardFocusManager

public DefaultKeyboardFocusManager()
Method Detail

dispatchEvent

public boolean dispatchEvent(AWTEvent e)
Description copied from class: KeyboardFocusManager
The AWT event dispatcher uses this method to request that the manager handle a particular event. If the manager fails or refuses to dispatch the supplied event (this method returns false), the AWT event dispatcher will try to dispatch the event itself.

The manager is expected to handle all FocusEvents and KeyEvents, and WindowEvents relating to the focus. Dispatch is done with regard to the the focus owner and the currently focused and active windows. In handling the event, the source of the event may be overridden.

The actual dispatching is performed by calling redispatchEvent(). This avoids the infinite recursion of dispatch requests which may occur if this method is called on the target component.

Specified by:
dispatchEvent in class KeyboardFocusManager

enqueueKeyEvent

private boolean enqueueKeyEvent(java.awt.event.KeyEvent e)

dispatchKeyEvent

public boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
Description copied from class: KeyboardFocusManager
Attempts to dispatch key events for which no key event dispatcher has so far succeeded. This method is usually called by dispatchEvent() following the sending of the key event to any registered key event dispatchers. If the key event reaches this stage, none of the dispatchers returned true. This is, of course, always the case if there are no registered dispatchers.

If this method also fails to handle the key event, then false is returned to the caller. In the case of dispatchEvent(), the calling method may try to handle the event itself or simply forward on the false result to its caller. When the event is dispatched by this method, a true result is propogated through the calling methods.

Specified by:
dispatchKeyEvent in interface KeyEventDispatcher
Specified by:
dispatchKeyEvent in class KeyboardFocusManager

postProcessKeyEvent

public boolean postProcessKeyEvent(java.awt.event.KeyEvent e)
Description copied from class: KeyboardFocusManager
Handles the post processing of key events. By default, this method will map unhandled key events to appropriate MenuShortcuts. The event is consumed in the process and the shortcut is activated. This method is usually called by dispatchKeyEvent.

Specified by:
postProcessKeyEvent in interface KeyEventPostProcessor
Specified by:
postProcessKeyEvent in class KeyboardFocusManager

processKeyEvent

public void processKeyEvent(Component comp,
                            java.awt.event.KeyEvent e)
Description copied from class: KeyboardFocusManager
Handles focus traversal operations for key events which represent focus traversal keys in relation to the supplied component. The supplied component is assumed to have the focus, whether it does so or not, and the operation is carried out as appropriate, with this in mind.

Specified by:
processKeyEvent in class KeyboardFocusManager

enqueueKeyEvents

protected void enqueueKeyEvents(long after,
                                Component untilFocused)
Description copied from class: KeyboardFocusManager
Delays all key events following the specified timestamp until the supplied component has focus. The AWT calls this method when it is determined that a focus change may occur within the native windowing system. Any key events which occur following the time specified by after are delayed until a FOCUS_GAINED event is received for the untilFocused component. The manager is responsible for ensuring this takes place.

Specified by:
enqueueKeyEvents in class KeyboardFocusManager

dequeueKeyEvents

protected void dequeueKeyEvents(long after,
                                Component untilFocused)
Description copied from class: KeyboardFocusManager
Removes the key event block specified by the supplied timestamp and component. All delayed key events are released for normal dispatching following its removal and subsequent key events that would have been blocked are now immediately dispatched. If the specified timestamp is below 0, then the request with the oldest timestamp is removed.

Specified by:
dequeueKeyEvents in class KeyboardFocusManager

discardKeyEvents

protected void discardKeyEvents(Component comp)
Description copied from class: KeyboardFocusManager
Discards all key event blocks relating to focus requirements for the supplied component, regardless of timestamp.

Specified by:
discardKeyEvents in class KeyboardFocusManager

focusPreviousComponent

public void focusPreviousComponent(Component comp)
Description copied from class: KeyboardFocusManager
Moves the current focus to the previous component, prior to comp, based on the current focus traversal policy. By default, only visible, displayable, accepted components can receive focus. Canvases, Panels, Labels, ScrollPanes, Scrollbars, Windows and lightweight components are judged to be unacceptable by default. See the DefaultFocusTraversalPolicy for more details.

Specified by:
focusPreviousComponent in class KeyboardFocusManager

focusNextComponent

public void focusNextComponent(Component comp)
Description copied from class: KeyboardFocusManager
Moves the current focus to the next component following comp, based on the current focus traversal policy. By default, only visible, displayable, accepted components can receive focus. Canvases, Panels, Labels, ScrollPanes, Scrollbars, Windows and lightweight components are judged to be unacceptable by default. See the DefaultFocusTraversalPolicy for more details.

Specified by:
focusNextComponent in class KeyboardFocusManager

upFocusCycle

public void upFocusCycle(Component comp)
Description copied from class: KeyboardFocusManager
Moves the current focus upwards by one focus cycle. Both the current focus owner and current focus cycle root become the focus cycle root of the supplied component. However, in the case of a Window, the default focus component becomes the focus owner and the focus cycle root is not changed.

Specified by:
upFocusCycle in class KeyboardFocusManager

downFocusCycle

public void downFocusCycle(Container cont)
Description copied from class: KeyboardFocusManager
Moves the current focus downwards by one focus cycle. If the supplied container is a focus cycle root, then this becomes the current focus cycle root and the focus goes to the default component of the specified container. Nothing happens for non-focus cycle root containers.

Specified by:
downFocusCycle in class KeyboardFocusManager