|
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||
java.lang.Object
|
+--java.awt.KeyEventDispatcher
|
+--java.awt.KeyboardFocusManager
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.
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(KeyEventDispatcher dispatcher)
Adds a KeyEventDispatcher to this KeyboardFocusManager's dispatcher chain. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property. |
void |
addVetoableChangeListener(java.lang.String propertyName,
java.beans.VetoableChangeListener listener)
Adds a VetoableChangeListener to the listener list for a specific property. |
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
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(long after,
java.awt.Component untilFocused)
Called by the AWT to notify the KeyboardFocusManager that it should cancel delayed dispatching of KeyEvents. |
protected abstract void |
discardKeyEvents(java.awt.Component comp)
Called by the AWT to notify the KeyboardFocusManager that it should cancel delayed dispatching of KeyEvents. |
abstract boolean |
dispatchEvent(java.awt.AWTEvent e)
This method is called by the AWT event dispatcher requesting that the current KeyboardFocusManager dispatch the specified event on its behalf. |
abstract boolean |
dispatchKeyEvent(java.awt.event.KeyEvent e)
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(java.awt.Container aContainer)
Moves the focus down one focus traversal cycle. |
protected abstract void |
enqueueKeyEvents(long after,
java.awt.Component untilFocused)
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(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires a PropertyChangeEvent in response to a change in a bound property. |
protected void |
fireVetoableChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
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(java.awt.Component aComponent)
Focuses the Component after aComponent, typically based on a FocusTraversalPolicy. |
void |
focusPreviousComponent()
Focuses the Component before the current focus owner. |
abstract void |
focusPreviousComponent(java.awt.Component aComponent)
Focuses the Component before aComponent, typically based on a FocusTraversalPolicy. |
java.awt.Window |
getActiveWindow()
Returns the active Window, if the active Window is in the same context as the calling thread. |
java.awt.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. |
java.util.Set |
getDefaultFocusTraversalKeys(int id)
Returns a Set of default focus traversal keys for a given traversal operation. |
FocusTraversalPolicy |
getDefaultFocusTraversalPolicy()
Returns the default FocusTraversalPolicy for all Windows that have no policy of their own set. |
java.awt.Window |
getFocusedWindow()
Returns the focused Window, if the focused Window is in the same context as the calling thread. |
java.awt.Component |
getFocusOwner()
Returns the focus owner, if the focus owner is in the same context as the calling thread. |
protected java.awt.Window |
getGlobalActiveWindow()
Returns the active Window, even if the calling thread is in a different context than the active Window. |
protected java.awt.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 java.awt.Window |
getGlobalFocusedWindow()
Returns the focused Window, even if the calling thread is in a different context than the focused Window. |
protected java.awt.Component |
getGlobalFocusOwner()
Returns the focus owner, even if the calling thread is in a different context than the focus owner. |
protected java.awt.Component |
getGlobalPermanentFocusOwner()
Returns the permanent focus owner, even if the calling thread is in a different context than the permanent focus owner. |
protected java.util.List |
getKeyEventDispatchers()
Returns this KeyboardFocusManager's KeyEventDispatcher chain as a List. |
java.awt.Component |
getPermanentFocusOwner()
Returns the permanent focus owner, if the permanent focus owner is in the same context as the calling thread. |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the PropertyChangeListeners
added to this KeyboardFocusManager with addPropertyChangeListener(). |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners(java.lang.String propertyName)
Returns an array of all the PropertyChangeListeners
associated with the named property. |
java.beans.VetoableChangeListener[] |
getVetoableChangeListeners()
Returns an array of all the VetoableChangeListeners
added to this KeyboardFocusManager with addVetoableChangeListener(). |
java.beans.VetoableChangeListener[] |
getVetoableChangeListeners(java.lang.String propertyName)
Returns an array of all the VetoableChangeListeners
associated with the named property. |
abstract void |
processKeyEvent(java.awt.Component focusedComponent,
java.awt.event.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 |
redispatchEvent(java.awt.Component target,
java.awt.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 |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list for a specific property. |
void |
removeVetoableChangeListener(java.lang.String propertyName,
java.beans.VetoableChangeListener listener)
Removes a VetoableChangeListener from the listener list for a specific property. |
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes a VetoableChangeListener from the listener list. |
static void |
setCurrentKeyboardFocusManager(KeyboardFocusManager newManager)
Sets the current KeyboardFocusManager instance for the calling thread's context. |
void |
setDefaultFocusTraversalKeys(int id,
java.util.Set keystrokes)
Sets the default focus traversal keys for a given traversal operation. |
void |
setDefaultFocusTraversalPolicy(FocusTraversalPolicy defaultPolicy)
Sets the default FocusTraversalPolicy for all Windows that have no policy of their own set. |
protected void |
setGlobalActiveWindow(java.awt.Window activeWindow)
Sets the active Window. |
void |
setGlobalCurrentFocusCycleRoot(java.awt.Container newFocusCycleRoot)
Sets the current focus cycle root. |
protected void |
setGlobalFocusedWindow(java.awt.Window focusedWindow)
Sets the focused Window. |
protected void |
setGlobalFocusOwner(java.awt.Component focusOwner)
Sets the focus owner. |
protected void |
setGlobalPermanentFocusOwner(java.awt.Component permanentFocusOwner)
Sets the permanent focus owner. |
void |
upFocusCycle()
Moves the focus up one focus traversal cycle from the current focus owner. |
abstract void |
upFocusCycle(java.awt.Component aComponent)
Moves the focus up one focus traversal cycle. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int FORWARD_TRAVERSAL_KEYS
setDefaultFocusTraversalKeys(int, java.util.Set),
getDefaultFocusTraversalKeys(int),
Component.setFocusTraversalKeys(int, java.util.Set),
Component.getFocusTraversalKeys(int)public static final int BACKWARD_TRAVERSAL_KEYS
setDefaultFocusTraversalKeys(int, java.util.Set),
getDefaultFocusTraversalKeys(int),
Component.setFocusTraversalKeys(int, java.util.Set),
Component.getFocusTraversalKeys(int)public static final int UP_CYCLE_TRAVERSAL_KEYS
setDefaultFocusTraversalKeys(int, java.util.Set),
getDefaultFocusTraversalKeys(int),
Component.setFocusTraversalKeys(int, java.util.Set),
Component.getFocusTraversalKeys(int)public static final int DOWN_CYCLE_TRAVERSAL_KEYS
setDefaultFocusTraversalKeys(int, java.util.Set),
getDefaultFocusTraversalKeys(int),
Component.setFocusTraversalKeys(int, java.util.Set),
Component.getFocusTraversalKeys(int)| Constructor Detail |
public KeyboardFocusManager()
| Method Detail |
public static KeyboardFocusManager getCurrentKeyboardFocusManager()
setCurrentKeyboardFocusManager(java.awt.KeyboardFocusManager)
public static void setCurrentKeyboardFocusManager(KeyboardFocusManager newManager)
throws java.lang.SecurityException
If a SecurityManager is installed, the calling thread must be granted the AWTPermission "replaceKeyboardFocusManager" in order to replace the the current KeyboardFocusManager. If this permission is not granted, this method will throw a SecurityException, and the current KeyboardFocusManager will be unchanged.
newManager - the new KeyboardFocusManager for this thread's contextjava.lang.SecurityException - if the calling thread does not have permission
to replace the current KeyboardFocusManagergetCurrentKeyboardFocusManager(),
DefaultKeyboardFocusManagerpublic java.awt.Component getFocusOwner()
getGlobalFocusOwner(),
setGlobalFocusOwner(java.awt.Component)
protected java.awt.Component getGlobalFocusOwner()
throws java.lang.SecurityException
This method will throw a SecurityException if this KeyboardFocusManager is not the current KeyboardFocusManager for the calling thread's context.
java.lang.SecurityException - if this KeyboardFocusManager is not the
current KeyboardFocusManager for the calling thread's contextgetFocusOwner(),
setGlobalFocusOwner(java.awt.Component)protected void setGlobalFocusOwner(java.awt.Component focusOwner)
This method does not actually set the focus to the specified Component.
It merely stores the value to be subsequently returned by
getFocusOwner(). Use Component.requestFocus()
or Component.requestFocusInWindow() to change the focus
owner, subject to platform limitations.
focusOwner - the focus ownergetFocusOwner(),
getGlobalFocusOwner(),
Component.requestFocus(),
Component.requestFocusInWindow(),
Component.isFocusable()public void clearGlobalFocusOwner()
requestFocus(). This operation
does not change the focused or active Windows.Component.requestFocus(),
FocusEvent.FOCUS_LOSTpublic java.awt.Component getPermanentFocusOwner()
getGlobalPermanentFocusOwner(),
setGlobalPermanentFocusOwner(java.awt.Component)
protected java.awt.Component getGlobalPermanentFocusOwner()
throws java.lang.SecurityException
This method will throw a SecurityException if this KeyboardFocusManager is not the current KeyboardFocusManager for the calling thread's context.
java.lang.SecurityException - if this KeyboardFocusManager is not the
current KeyboardFocusManager for the calling thread's contextgetPermanentFocusOwner(),
setGlobalPermanentFocusOwner(java.awt.Component)protected void setGlobalPermanentFocusOwner(java.awt.Component permanentFocusOwner)
This method does not actually set the focus to the specified Component.
It merely stores the value to be subsequently returned by
getPermanentFocusOwner(). Use
Component.requestFocus() or
Component.requestFocusInWindow() to change the focus owner,
subject to platform limitations.
permanentFocusOwner - the permanent focus ownergetPermanentFocusOwner(),
getGlobalPermanentFocusOwner(),
Component.requestFocus(),
Component.requestFocusInWindow(),
Component.isFocusable()public java.awt.Window getFocusedWindow()
getGlobalFocusedWindow(),
setGlobalFocusedWindow(java.awt.Window)
protected java.awt.Window getGlobalFocusedWindow()
throws java.lang.SecurityException
This method will throw a SecurityException if this KeyboardFocusManager is not the current KeyboardFocusManager for the calling thread's context.
java.lang.SecurityException - if this KeyboardFocusManager is not the
current KeyboardFocusManager for the calling thread's contextgetFocusedWindow(),
setGlobalFocusedWindow(java.awt.Window)protected void setGlobalFocusedWindow(java.awt.Window focusedWindow)
This method does not actually change the focused Window as far as the
native windowing system is concerned. It merely stores the value to be
subsequently returned by getFocusedWindow(). Use
Component.requestFocus() or
Component.requestFocusInWindow() to change the focused
Window, subject to platform limitations.
focusedWindow - the focused WindowgetFocusedWindow(),
getGlobalFocusedWindow(),
Component.requestFocus(),
Component.requestFocusInWindow(),
Window.isFocusableWindow()public java.awt.Window getActiveWindow()
getGlobalActiveWindow(),
setGlobalActiveWindow(java.awt.Window)
protected java.awt.Window getGlobalActiveWindow()
throws java.lang.SecurityException
This method will throw a SecurityException if this KeyboardFocusManager is not the current KeyboardFocusManager for the calling thread's context.
java.lang.SecurityException - if this KeyboardFocusManager is not the
current KeyboardFocusManager for the calling thread's contextgetActiveWindow(),
setGlobalActiveWindow(java.awt.Window)protected void setGlobalActiveWindow(java.awt.Window activeWindow)
This method does not actually change the active Window as far as the
native windowing system is concerned. It merely stores the value to be
subsequently returned by getActiveWindow(). Use
Component.requestFocus() or
Component.requestFocusInWindow()to change the active
Window, subject to platform limitations.
activeWindow - the active WindowgetActiveWindow(),
getGlobalActiveWindow(),
Component.requestFocus(),
Component.requestFocusInWindow()public FocusTraversalPolicy getDefaultFocusTraversalPolicy()
setDefaultFocusTraversalPolicy(java.awt.FocusTraversalPolicy),
Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy),
Container.getFocusTraversalPolicy()public void setDefaultFocusTraversalPolicy(FocusTraversalPolicy defaultPolicy)
defaultPolicy - the new, default FocusTraversalPolicyjava.lang.IllegalArgumentException - if defaultPolicy is nullgetDefaultFocusTraversalPolicy(),
Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy),
Container.getFocusTraversalPolicy()
public void setDefaultFocusTraversalKeys(int id,
java.util.Set keystrokes)
The default values for the default focus traversal keys are implementation-dependent. Sun recommends that all implementations for a particular native platform use the same default values. The recommendations for Windows and Unix are listed below. These recommendations are used in the Sun AWT implementations.
| Identifier | Meaning | Default | |
|---|---|---|---|
| KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS | Normal forward keyboard traversal | TAB on KEY_PRESSED, CTRL-TAB on KEY_PRESSED | |
| KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS | Normal reverse keyboard traversal | SHIFT-TAB on KEY_PRESSED, CTRL-SHIFT-TAB on KEY_PRESSED | |
| KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS | Go up one focus traversal cycle | none | |
| KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS | Go down one focus traversal cycle | none |
Using the AWTKeyStroke API, client code can specify on which of two specific KeyEvents, KEY_PRESSED or KEY_RELEASED, the focus traversal operation will occur. Regardless of which KeyEvent is specified, however, all KeyEvents related to the focus traversal key, including the associated KEY_TYPED event, will be consumed, and will not be dispatched to any Component. It is a runtime error to specify a KEY_TYPED event as mapping to a focus traversal operation, or to map the same event to multiple default focus traversal operations.
id - one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYSkeystrokes - the Set of AWTKeyStrokes for the specified operationjava.lang.IllegalArgumentException - if id is not one of
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, or if keystrokes
is null, or if keystrokes contains null, or if any Object in
keystrokes is not an AWTKeyStroke, or if any keystroke
represents a KEY_TYPED event, or if any keystroke already maps
to another default focus traversal operationgetDefaultFocusTraversalKeys(int),
Component.setFocusTraversalKeys(int, java.util.Set),
Component.getFocusTraversalKeys(int)public java.util.Set getDefaultFocusTraversalKeys(int id)
setDefaultFocusTraversalKeys for a full description of each
operation.)id - one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYSjava.lang.IllegalArgumentException - if id is not one of
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYSsetDefaultFocusTraversalKeys(int, java.util.Set),
Component.setFocusTraversalKeys(int, java.util.Set),
Component.getFocusTraversalKeys(int)public java.awt.Container getCurrentFocusCycleRoot()
This method is intended to be used only by KeyboardFocusManagers and focus implementations. It is not for general client use.
getGlobalCurrentFocusCycleRoot(),
setGlobalCurrentFocusCycleRoot(java.awt.Container)
protected java.awt.Container getGlobalCurrentFocusCycleRoot()
throws java.lang.SecurityException
This method will throw a SecurityException if this KeyboardFocusManager is not the current KeyboardFocusManager for the calling thread's context.
java.lang.SecurityException - if this KeyboardFocusManager is not the
current KeyboardFocusManager for the calling thread's contextgetCurrentFocusCycleRoot(),
setGlobalCurrentFocusCycleRoot(java.awt.Container)public void setGlobalCurrentFocusCycleRoot(java.awt.Container newFocusCycleRoot)
This method is intended to be used only by KeyboardFocusManagers and focus implementations. It is not for general client use.
newFocusCycleRoot - the new focus cycle rootgetCurrentFocusCycleRoot(),
getGlobalCurrentFocusCycleRoot()public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - the PropertyChangeListener to be addedremovePropertyChangeListener(java.beans.PropertyChangeListener),
getPropertyChangeListeners(),
addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
If listener is null, no exception is thrown and no action is performed.
listener - the PropertyChangeListener to be removedaddPropertyChangeListener(java.beans.PropertyChangeListener),
getPropertyChangeListeners(),
removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListeners
added to this KeyboardFocusManager with addPropertyChangeListener().PropertyChangeListeners added or
an empty array if no listeners have been addedaddPropertyChangeListener(java.beans.PropertyChangeListener),
removePropertyChangeListener(java.beans.PropertyChangeListener),
getPropertyChangeListeners(java.lang.String)
public void addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
propertyName - one of the property names listed abovelistener - the PropertyChangeListener to be addedaddPropertyChangeListener(java.beans.PropertyChangeListener),
#removePropertyChangeListener(java.lang.String),
getPropertyChangeListeners(java.lang.String)
public void removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
If listener is null, no exception is thrown and no action is performed.
propertyName - a valid property namelistener - the PropertyChangeListener to be removed#addPropertyChangeListener(java.lang.String),
getPropertyChangeListeners(java.lang.String),
removePropertyChangeListener(java.beans.PropertyChangeListener)public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
PropertyChangeListeners
associated with the named property.PropertyChangeListeners associated with
the named property or an empty array if no such listeners have
been added.#addPropertyChangeListener(java.lang.String),
#removePropertyChangeListener(java.lang.String)
protected void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
propertyName - the name of the property that has changedoldValue - the property's previous valuenewValue - the property's new valuepublic void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener - the VetoableChangeListener to be addedremoveVetoableChangeListener(java.beans.VetoableChangeListener),
getVetoableChangeListeners(),
addVetoableChangeListener(java.lang.String,java.beans.VetoableChangeListener)public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
If listener is null, no exception is thrown and no action is performed.
listener - the VetoableChangeListener to be removedaddVetoableChangeListener(java.beans.VetoableChangeListener),
getVetoableChangeListeners(),
removeVetoableChangeListener(java.lang.String,java.beans.VetoableChangeListener)public java.beans.VetoableChangeListener[] getVetoableChangeListeners()
VetoableChangeListeners
added to this KeyboardFocusManager with addVetoableChangeListener().VetoableChangeListeners added or
an empty array if no listeners have been addedaddVetoableChangeListener(java.beans.VetoableChangeListener),
removeVetoableChangeListener(java.beans.VetoableChangeListener),
getVetoableChangeListeners(java.lang.String)
public void addVetoableChangeListener(java.lang.String propertyName,
java.beans.VetoableChangeListener listener)
propertyName - one of the property names listed abovelistener - the VetoableChangeListener to be addedaddVetoableChangeListener(java.beans.VetoableChangeListener),
removeVetoableChangeListener(java.beans.VetoableChangeListener),
getVetoableChangeListeners()
public void removeVetoableChangeListener(java.lang.String propertyName,
java.beans.VetoableChangeListener listener)
If listener is null, no exception is thrown and no action is performed.
propertyName - a valid property namelistener - the VetoableChangeListener to be removedaddVetoableChangeListener(java.beans.VetoableChangeListener),
getVetoableChangeListeners(),
removeVetoableChangeListener(java.beans.VetoableChangeListener)public java.beans.VetoableChangeListener[] getVetoableChangeListeners(java.lang.String propertyName)
VetoableChangeListeners
associated with the named property.VetoableChangeListeners associated with
the named property or an empty array if no such listeners have
been added.#addVetoableChangeListener(java.lang.String),
#removeVetoableChangeListener(java.lang.String),
getVetoableChangeListeners()
protected void fireVetoableChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
throws java.beans.PropertyVetoException
propertyName - the name of the property that has changedoldValue - the property's previous valuenewValue - the property's new valuejava.beans.PropertyVetoException - if a
VetoableChangeListener threw
PropertyVetoExceptionpublic void addKeyEventDispatcher(KeyEventDispatcher dispatcher)
true from its
dispatchKeyEvent method. There is no limit to the total
number of KeyEventDispatchers which can be added, nor to the number of
times which a particular KeyEventDispatcher instance can be added.
If a null dispatcher is specified, no action is taken and no exception is thrown.
dispatcher - the KeyEventDispatcher to add to the dispatcher chainremoveKeyEventDispatcher(java.awt.KeyEventDispatcher)public void removeKeyEventDispatcher(KeyEventDispatcher dispatcher)
addKeyEventDispatcher.
If a null dispatcher is specified, if the specified dispatcher is not in the dispatcher chain, or if this KeyboardFocusManager is specified without having been explicitly re-registered, no action is taken and no exception is thrown.
dispatcher - the KeyEventDispatcher to remove from the dispatcher
chainaddKeyEventDispatcher(java.awt.KeyEventDispatcher)protected java.util.List getKeyEventDispatchers()
addKeyEventDispatcher. If no other KeyEventDispatchers are
registered, implementations are free to return null or a List of length
0. Client code should not assume one behavior over another, nor should
it assume that the behavior, once established, will not change.addKeyEventDispatcher(java.awt.KeyEventDispatcher),
removeKeyEventDispatcher(java.awt.KeyEventDispatcher)public abstract boolean dispatchEvent(java.awt.AWTEvent e)
redispatchEvent to prevent the AWT event
dispatcher from recursively requesting that the KeyboardFocusManager
dispatch the event again. If this method returns false,
then the AWT event dispatcher will attempt to dispatch the event itself.e - the AWTEvent to be dispatchedtrue if this method dispatched the event;
false otherwiseredispatchEvent(java.awt.Component, java.awt.AWTEvent),
dispatchKeyEvent(java.awt.event.KeyEvent)
public final void redispatchEvent(java.awt.Component target,
java.awt.AWTEvent e)
dispatchEvent and client-defined
KeyEventDispatchers must call redispatchEvent(target, e)
instead of target.dispatchEvent(e) to dispatch an event.
This method is intended to be used only by KeyboardFocusManagers and KeyEventDispatchers. It is not for general client use.
target - the Component to which the event should be dispatchede - the event to dispatchdispatchEvent(java.awt.AWTEvent),
KeyEventDispatcherpublic abstract boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
dispatchEvent if no
other KeyEventDispatcher in the dispatcher chain dispatched the
KeyEvent, or if no other KeyEventDispatchers are registered. If an
implementation of this method returns false,
dispatchEvent may try to dispatch the KeyEvent itself, or
may simply return false. If true is returned,
dispatchEvent should return true as well.dispatchKeyEvent in class KeyEventDispatchere - the KeyEvent which the current KeyboardFocusManager has
requested that this KeyEventDispatcher dispatchtrue if the KeyEvent was dispatched;
false otherwisedispatchEvent(java.awt.AWTEvent)
public abstract void processKeyEvent(java.awt.Component focusedComponent,
java.awt.event.KeyEvent e)
focusedComponent - the Component that will be the basis for a focus
traversal operation if the specified event represents a focus
traversal key for the Componente - the event that may represent a focus traversal key
protected abstract void enqueueKeyEvents(long after,
java.awt.Component untilFocused)
dequeueKeyEvents or
discardKeyEvents.after - timestamp of current event, or the current, system time if
the current event has no timestamp, or the AWT cannot determine
which event is currently being handleduntilFocused - Component which should receive a FOCUS_GAINED event
before any pending KeyEventsdequeueKeyEvents(long, java.awt.Component),
discardKeyEvents(java.awt.Component)
protected abstract void dequeueKeyEvents(long after,
java.awt.Component untilFocused)
enqueueKeyEvents with the
same timestamp and Component should be released for normal dispatching
to the current focus owner. If the given timestamp is less than zero,
the outstanding enqueue request for the given Component with the
oldest timestamp (if any) should be cancelled.after - the timestamp specified in the call to
enqueueKeyEvents, or any value < 0untilFocused - the Component specified in the call to
enqueueKeyEventsenqueueKeyEvents(long, java.awt.Component),
discardKeyEvents(java.awt.Component)protected abstract void discardKeyEvents(java.awt.Component comp)
enqueueKeyEvents
with the same Component should be discarded.comp - the Component specified in one or more calls to
enqueueKeyEventsenqueueKeyEvents(long, java.awt.Component),
dequeueKeyEvents(long, java.awt.Component)public abstract void focusNextComponent(java.awt.Component aComponent)
aComponent - the Component that is the basis for the focus
traversal operationFocusTraversalPolicypublic abstract void focusPreviousComponent(java.awt.Component aComponent)
aComponent - the Component that is the basis for the focus
traversal operationFocusTraversalPolicypublic abstract void upFocusCycle(java.awt.Component aComponent)
aComponent - the Component that is the basis for the focus
traversal operationpublic abstract void downFocusCycle(java.awt.Container aContainer)
aComponent - the Component that is the basis for the focus
traversal operationpublic final void focusNextComponent()
public final void focusPreviousComponent()
public final void upFocusCycle()
public final void downFocusCycle()
|
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||