Class DefaultFocusManager
java.lang.Object
java.awt.KeyboardFocusManager
java.awt.DefaultKeyboardFocusManager
javax.swing.FocusManager
javax.swing.DefaultFocusManager
- All Implemented Interfaces:
KeyEventDispatcher, KeyEventPostProcessor
This class has been obsoleted by the 1.4 focus APIs. While client code may
still use this class, developers are strongly encouraged to use
java.awt.KeyboardFocusManager
and
java.awt.DefaultKeyboardFocusManager
instead.
Please see How to Use the Focus Subsystem, a section in The Java Tutorial, and the Focus Specification for more information.
- Since:
- 1.2
-
Field Summary
Fields declared in class FocusManager
FOCUS_MANAGER_CLASS_PROPERTY
Modifier and TypeFieldDescriptionstatic final String
This field is obsolete, and its use is discouraged since its specification is incompatible with the 1.4 focus APIs.Fields declared in class KeyboardFocusManager
BACKWARD_TRAVERSAL_KEYS, DOWN_CYCLE_TRAVERSAL_KEYS, FORWARD_TRAVERSAL_KEYS, UP_CYCLE_TRAVERSAL_KEYS
Modifier and TypeFieldDescriptionstatic final int
The identifier for the Backward focus traversal keys.static final int
The identifier for the Down Cycle focus traversal keys.static final int
The identifier for the Forward focus traversal keys.static final int
The identifier for the Up Cycle focus traversal keys. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares the components by their focus traversal cycle order.getComponentAfter
(Container aContainer, Component aComponent) Returns the component after.getComponentBefore
(Container aContainer, Component aComponent) Returns the component before.getFirstComponent
(Container aContainer) Returns the first component.getLastComponent
(Container aContainer) Returns the last component.Methods declared in class FocusManager
disableSwingFocusManager, getCurrentManager, isFocusManagerEnabled, setCurrentManager
Modifier and TypeMethodDescriptionstatic void
Deprecated.static FocusManager
Returns the currentKeyboardFocusManager
instance for the calling thread's context.static boolean
Deprecated.As of 1.4, replaced byKeyboardFocusManager.getDefaultFocusTraversalPolicy()
static void
setCurrentManager
(FocusManager aFocusManager) Sets the currentKeyboardFocusManager
instance for the calling thread's context.Methods declared in class DefaultKeyboardFocusManager
dequeueKeyEvents, discardKeyEvents, dispatchEvent, dispatchKeyEvent, downFocusCycle, enqueueKeyEvents, focusNextComponent, focusPreviousComponent, postProcessKeyEvent, processKeyEvent, upFocusCycle
Modifier and TypeMethodDescriptionprotected void
dequeueKeyEvents
(long after, Component untilFocused) Releases for normal dispatching to the current focus owner all KeyEvents which were enqueued because of a call toenqueueKeyEvents
with the same timestamp and Component.protected void
discardKeyEvents
(Component comp) Discards all KeyEvents which were enqueued because of one or more calls toenqueueKeyEvents
with the specified Component, or one of its descendants.boolean
This method is called by the AWT event dispatcher requesting that the current KeyboardFocusManager dispatch the specified event on its behalf.boolean
Called bydispatchEvent
if no other KeyEventDispatcher in the dispatcher chain dispatched the KeyEvent, or if no other KeyEventDispatchers are registered.void
downFocusCycle
(Container aContainer) Moves the focus down one focus traversal cycle.protected void
enqueueKeyEvents
(long after, Component untilFocused) Delays dispatching of KeyEvents until the specified Component becomes the focus owner.void
focusNextComponent
(Component aComponent) Focuses the Component after aComponent, typically based on a FocusTraversalPolicy.void
focusPreviousComponent
(Component aComponent) Focuses the Component before aComponent, typically based on a FocusTraversalPolicy.boolean
This method will be called bydispatchKeyEvent
.void
processKeyEvent
(Component focusedComponent, KeyEvent e) This method initiates a focus traversal operation if and only if the KeyEvent represents a focus traversal key for the specified focusedComponent.void
upFocusCycle
(Component aComponent) Moves the focus up one focus traversal cycle.Methods declared in class KeyboardFocusManager
addKeyEventDispatcher, addKeyEventPostProcessor, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clearFocusOwner, 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
Modifier and TypeMethodDescriptionvoid
addKeyEventDispatcher
(KeyEventDispatcher dispatcher) Adds a KeyEventDispatcher to this KeyboardFocusManager's dispatcher chain.void
addKeyEventPostProcessor
(KeyEventPostProcessor processor) Adds a KeyEventPostProcessor to this KeyboardFocusManager's post- processor chain.void
Adds a PropertyChangeListener to the listener list.void
addPropertyChangeListener
(String propertyName, PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property.void
Adds a VetoableChangeListener to the listener list.void
addVetoableChangeListener
(String propertyName, VetoableChangeListener listener) Adds a VetoableChangeListener to the listener list for a specific property.void
Clears the focus owner at both the Java and native levels if the focus owner exists and resides in the same context as the calling thread, otherwise the method returns silently.void
Clears the global focus owner at both the Java and native levels.final void
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.protected void
firePropertyChange
(String propertyName, Object oldValue, Object newValue) Fires a PropertyChangeEvent in response to a change in a bound property.protected void
fireVetoableChange
(String propertyName, Object oldValue, Object newValue) Fires a PropertyChangeEvent in response to a change in a vetoable property.final void
Focuses the Component after the current focus owner.final void
Focuses the Component before the current focus owner.Returns the active Window, if the active Window is in the same context as the calling thread.Returns the current focus cycle root, if the current focus cycle root is in the same context as the calling thread.static KeyboardFocusManager
Returns the current KeyboardFocusManager instance for the calling thread's context.getDefaultFocusTraversalKeys
(int id) Returns a Set of default focus traversal keys for a given traversal operation.Returns the default FocusTraversalPolicy.Returns the focused Window, if the focused Window is in the same context as the calling thread.Returns the focus owner, if the focus owner is in the same context as the calling thread.protected Window
Returns the active Window, even if the calling thread is in a different context than the active Window.protected Container
Returns the current focus cycle root, even if the calling thread is in a different context than the current focus cycle root.protected Window
Returns the focused Window, even if the calling thread is in a different context than the focused Window.protected Component
Returns the focus owner, even if the calling thread is in a different context than the focus owner.protected Component
Returns the permanent focus owner, even if the calling thread is in a different context than the permanent focus owner.protected List
<KeyEventDispatcher> Returns this KeyboardFocusManager's KeyEventDispatcher chain as a List.protected List
<KeyEventPostProcessor> Returns this KeyboardFocusManager's KeyEventPostProcessor chain as a List.Returns the permanent focus owner, if the permanent focus owner is in the same context as the calling thread.Returns an array of all the property change listeners registered on this keyboard focus manager.getPropertyChangeListeners
(String propertyName) Returns an array of all thePropertyChangeListener
s associated with the named property.Returns an array of all the vetoable change listeners registered on this keyboard focus manager.getVetoableChangeListeners
(String propertyName) Returns an array of all theVetoableChangeListener
s associated with the named property.final void
redispatchEvent
(Component target, AWTEvent e) 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
(KeyEventDispatcher dispatcher) Removes a KeyEventDispatcher which was previously added to this KeyboardFocusManager's dispatcher chain.void
removeKeyEventPostProcessor
(KeyEventPostProcessor processor) Removes a previously added KeyEventPostProcessor from this KeyboardFocusManager's post-processor chain.void
Removes a PropertyChangeListener from the listener list.void
removePropertyChangeListener
(String propertyName, PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property.void
Removes a VetoableChangeListener from the listener list.void
removeVetoableChangeListener
(String propertyName, VetoableChangeListener listener) Removes a VetoableChangeListener from the listener list for a specific property.static void
setCurrentKeyboardFocusManager
(KeyboardFocusManager newManager) Sets the current KeyboardFocusManager instance for the calling thread's context.void
setDefaultFocusTraversalKeys
(int id, Set<? extends AWTKeyStroke> keystrokes) Sets the default focus traversal keys for a given traversal operation.void
setDefaultFocusTraversalPolicy
(FocusTraversalPolicy defaultPolicy) Sets the default FocusTraversalPolicy.protected void
setGlobalActiveWindow
(Window activeWindow) Sets the active Window.void
setGlobalCurrentFocusCycleRoot
(Container newFocusCycleRoot) Sets the current focus cycle root.protected void
setGlobalFocusedWindow
(Window focusedWindow) Sets the focused Window.protected void
setGlobalFocusOwner
(Component focusOwner) Sets the focus owner.protected void
setGlobalPermanentFocusOwner
(Component permanentFocusOwner) Sets the permanent focus owner.final void
Moves the focus up one focus traversal cycle from the current focus owner.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
DefaultFocusManager
public DefaultFocusManager()Constructs aDefaultFocusManager
.
-
-
Method Details
-
getComponentAfter
-
getComponentBefore
-
getFirstComponent
-
getLastComponent
-
compareTabOrder
-
KeyboardFocusManager.setDefaultFocusTraversalPolicy(FocusTraversalPolicy)