Class ActionMap
java.lang.Object
javax.swing.ActionMap
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ActionMapUIResource
ActionMap
provides mappings from
Object
s
(called keys or Action
names)
to Action
s.
An ActionMap
is usually used with an InputMap
to locate a particular action
when a key is pressed. As with InputMap
,
an ActionMap
can have a parent
that is searched for keys not defined in the ActionMap
.
As with InputMap
if you create a cycle, eg:
ActionMap am = new ActionMap(); ActionMap bm = new ActionMap(): am.setParent(bm); bm.setParent(am);some of the methods will cause a StackOverflowError to be thrown.
- Since:
- 1.3
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObject[]
allKeys()
Returns an array of the keys defined in thisActionMap
and its parent.void
clear()
Removes all the mappings from thisActionMap
.Returns the binding forkey
, messaging the parentActionMap
if the binding is not locally defined.Returns thisActionMap
's parent.Object[]
keys()
Returns theAction
names that are bound in thisActionMap
.void
Adds a binding forkey
toaction
.void
Removes the binding forkey
from thisActionMap
.void
Sets thisActionMap
's parent.int
size()
Returns the number of bindings in thisActionMap
.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
-
ActionMap
public ActionMap()Creates anActionMap
with no parent and no mappings.
-
-
Method Details
-
setParent
Sets thisActionMap
's parent.- Parameters:
map
- theActionMap
that is the parent of this one
-
getParent
Returns thisActionMap
's parent.- Returns:
- the
ActionMap
that is the parent of this one, or null if thisActionMap
has no parent
-
put
-
get
-
remove
Removes the binding forkey
from thisActionMap
.- Parameters:
key
- a key
-
clear
public void clear()Removes all the mappings from thisActionMap
. -
keys
Returns theAction
names that are bound in thisActionMap
.- Returns:
- an array of the keys
-
size
public int size()Returns the number of bindings in thisActionMap
.- Returns:
- the number of bindings in this
ActionMap
-
allKeys
Returns an array of the keys defined in thisActionMap
and its parent. This method differs fromkeys()
in that this method includes the keys defined in the parent.- Returns:
- an array of the keys
-