|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.awt.KeyboardFocusManager
, KeyEventPostProcessor


public abstract class KeyboardFocusManager

, KeyEventPostProcessor

The KeyboardFocusManager is responsible for managing the active and focused Windows, and the current focus owner. The focus owner is defined as the Component in an application that will typically receive all KeyEvents generated by the user. The focused Window is the Window that is, or contains, the focus owner. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.
The KeyboardFocusManager is both a centralized location for client code to query for the focus owner and initiate focus changes, and an event dispatcher for all FocusEvents, WindowEvents related to focus, and KeyEvents.
Some browsers partition applets in different code bases into separate contexts, and establish walls between these contexts. In such a scenario, there will be one KeyboardFocusManager per context. Other browsers place all applets into the same context, implying that there will be only a single, global KeyboardFocusManager for all applets. This behavior is implementation-dependent. Consult your browser's documentation for more information. No matter how many contexts there may be, however, there can never be more than one focus owner, focused Window, or active Window, per ClassLoader.
Please see How to Use the Focus Subsystem, a section in The Java Tutorial, and the Focus Specification for more information.
Window
,
Frame
,
Dialog
,
FocusEvent
,
WindowEvent
,
KeyEvent

| Field Summary | |
|---|---|
static int |
BACKWARD_TRAVERSAL_KEYS
The identifier for the Backward focus traversal keys. |
static int |
DOWN_CYCLE_TRAVERSAL_KEYS
The identifier for the Down Cycle focus traversal keys. |
static int |
FORWARD_TRAVERSAL_KEYS
The identifier for the Forward focus traversal keys. |
static int |
UP_CYCLE_TRAVERSAL_KEYS
The identifier for the Up Cycle focus traversal keys. |
| Constructor Summary | |
|---|---|
KeyboardFocusManager
Initializes a KeyboardFocusManager. |
|
| Method Summary | |
|---|---|
void |
addKeyEventDispatcher
Adds a KeyEventDispatcher to this KeyboardFocusManager's dispatcher chain. |
void |
addKeyEventPostProcessor
Adds a KeyEventPostProcessor to this KeyboardFocusManager's post- processor chain. |
void |
addPropertyChangeListener
Adds a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener
Adds a PropertyChangeListener to the listener list for a specific property. |
void |
addVetoableChangeListener
Adds a VetoableChangeListener to the listener list for a specific property. |
void |
addVetoableChangeListener
Adds a VetoableChangeListener to the listener list. |
void |
clearGlobalFocusOwner
Clears the global focus owner at both the Java and native levels. |
protected abstract void |
dequeueKeyEvents
Called by the AWT to notify the KeyboardFocusManager that it should cancel delayed dispatching of KeyEvents. |
protected abstract void |
discardKeyEvents
Called by the AWT to notify the KeyboardFocusManager that it should cancel delayed dispatching of KeyEvents. |
abstract boolean |
dispatchEvent
This method is called by the AWT event dispatcher requesting that the current KeyboardFocusManager dispatch the specified event on its behalf. |
abstract boolean |
dispatchKeyEvent
Typically this method will be called by dispatchEvent if no
other KeyEventDispatcher in the dispatcher chain dispatched the
KeyEvent, or if no other KeyEventDispatchers are registered. |
void |
downFocusCycle
Moves the focus down one focus traversal cycle from the current focus owner, if and only if the current focus owner is a Container that is a focus cycle root. |
abstract void |
downFocusCycle
Moves the focus down one focus traversal cycle. |
protected abstract void |
enqueueKeyEvents
Called by the AWT to notify the KeyboardFocusManager that it should delay dispatching of KeyEvents until the specified Component becomes the focus owner. |
protected void |
firePropertyChange
Fires a PropertyChangeEvent in response to a change in a bound property. |
protected void |
fireVetoableChange
Fires a PropertyChangeEvent in response to a change in a vetoable property. |
void |
focusNextComponent
Focuses the Component after the current focus owner. |
abstract void |
focusNextComponent
Focuses the Component after aComponent, typically based on a FocusTraversalPolicy. |
void |
focusPreviousComponent
Focuses the Component before the current focus owner. |
abstract void |
focusPreviousComponent
Focuses the Component before aComponent, typically based on a FocusTraversalPolicy. |
Window |
getActiveWindow
Returns the active Window, if the active Window is in the same context as the calling thread. |
Container |
getCurrentFocusCycleRoot
Returns the current focus cycle root, if the current focus cycle root is in the same context as the calling thread. |
static KeyboardFocusManager |
getCurrentKeyboardFocusManager
Returns the current KeyboardFocusManager instance for the calling thread's context. |
Set |
getDefaultFocusTraversalKeys
Returns a Set of default focus traversal keys for a given traversal operation. |
FocusTraversalPolicy |
getDefaultFocusTraversalPolicy
Returns the default FocusTraversalPolicy. |
Window |
getFocusedWindow
Returns the focused Window, if the focused Window is in the same context as the calling thread. |
Component |
getFocusOwner
Returns the focus owner, if the focus owner is in the same context as the calling thread. |
protected Window |
getGlobalActiveWindow
Returns the active Window, even if the calling thread is in a different context than the active Window. |
protected Container |
getGlobalCurrentFocusCycleRoot
Returns the current focus cycle root, even if the calling thread is in a different context than the current focus cycle root. |
protected Window |
getGlobalFocusedWindow
Returns the focused Window, even if the calling thread is in a different context than the focused Window. |
protected Component |
getGlobalFocusOwner
Returns the focus owner, even if the calling thread is in a different context than the focus owner. |
protected Component |
getGlobalPermanentFocusOwner
Returns the permanent focus owner, even if the calling thread is in a different context than the permanent focus owner. |
protected List |
getKeyEventDispatchers
Returns this KeyboardFocusManager's KeyEventDispatcher chain as a List. |
protected List |
getKeyEventPostProcessors
Returns this KeyboardFocusManager's KeyEventPostProcessor chain as a List. |
Component |
getPermanentFocusOwner
Returns the permanent focus owner, if the permanent focus owner is in the same context as the calling thread. |
PropertyChangeListener |
getPropertyChangeListeners
Returns an array of all the property change listeners registered on this keyboard focus manager. |
PropertyChangeListener |
getPropertyChangeListeners
Returns an array of all the PropertyChangeListeners
associated with the named property. |
VetoableChangeListener |
getVetoableChangeListeners
Returns an array of all the vetoable change listeners registered on this keyboard focus manager. |
VetoableChangeListener |
getVetoableChangeListeners
Returns an array of all the VetoableChangeListeners
associated with the named property. |
abstract boolean |
postProcessKeyEvent
This method will be called by dispatchKeyEvent. |
abstract void |
processKeyEvent
This method initiates a focus traversal operation if and only if the KeyEvent represents a focus traversal key for the specified focusedComponent. |
void |
redispatchEvent
Redispatches an AWTEvent in such a way that the AWT event dispatcher will not recursively request that the KeyboardFocusManager, or any installed KeyEventDispatchers, dispatch the event again. |
void |
removeKeyEventDispatcher
Removes a KeyEventDispatcher which was previously added to this KeyboardFocusManager's dispatcher chain. |
void |
removeKeyEventPostProcessor
Removes a previously added KeyEventPostProcessor from this KeyboardFocusManager's post-processor chain. |
void |
removePropertyChangeListener
Removes a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener
Removes a PropertyChangeListener from the listener list for a specific property. |
void |
removeVetoableChangeListener
Removes a VetoableChangeListener from the listener list for a specific property. |
void |
removeVetoableChangeListener
Removes a VetoableChangeListener from the listener list. |
static void |
setCurrentKeyboardFocusManager
Sets the current KeyboardFocusManager instance for the calling thread's context. |
void |
setDefaultFocusTraversalKeys
Sets the default focus traversal keys for a given traversal operation. |
void |
setDefaultFocusTraversalPolicy
Sets the default FocusTraversalPolicy. |
protected void |
setGlobalActiveWindow
Sets the active Window. |
void |
setGlobalCurrentFocusCycleRoot
Sets the current focus cycle root. |
protected void |
setGlobalFocusedWindow
Sets the focused Window. |
protected void |
setGlobalFocusOwner
Sets the focus owner. |
protected void |
setGlobalPermanentFocusOwner
Sets the permanent focus owner. |
void |
upFocusCycle |