ActionMap provides mappings from
Objects
(called keys or Action names)
to Actions.
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.
InputMap
| Modifier and Type | Field and Description |
|---|---|
| private transient ArrayTable | arrayTable
Handles the mapping between Action name and Action. |
| private ActionMap | parent
Parent that handles any bindings we don't contain. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object[] | Returns: an array of the keysReturns an array of the keys defined in this |
| public void | |
| public Action | |
| public ActionMap | Returns: theActionMap that is the parent of this one,
or null if this ActionMap has no parentReturns this |
| public Object[] | |
| public void | |
| private void | |
| public void | |
| public void | |
| public int | Returns: the number of bindings in thisActionMapReturns the number of bindings in this |
| private void |
| arrayTable | back to summary |
|---|---|
| private transient ArrayTable arrayTable Handles the mapping between Action name and Action. | |
| parent | back to summary |
|---|---|
| private ActionMap parent Parent that handles any bindings we don't contain. | |
| ActionMap | back to summary |
|---|---|
| public ActionMap() Creates an | |
| allKeys | back to summary |
|---|---|
| public Object[] allKeys() Returns an array of the keys defined in this
| |
| clear | back to summary |
|---|---|
| public void clear() Removes all the mappings from this | |
| get | back to summary |
|---|---|
| public Action get(Object key) Returns the binding for | |
| getParent | back to summary |
|---|---|
| public ActionMap getParent() Returns this
| |
| keys | back to summary |
|---|---|
| public Object[] keys() Returns the
| |
| put | back to summary |
|---|---|
| public void put(Object key, Action action) Adds a binding for In most instances, | |
| readObject | back to summary |
|---|---|
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException
| |
| remove | back to summary |
|---|---|
| public void remove(Object key) Removes the binding for
| |
| setParent | back to summary |
|---|---|
| public void setParent(ActionMap map) Sets this
| |
| size | back to summary |
|---|---|
| public int size() Returns the number of bindings in this
| |
| writeObject | back to summary |
|---|---|
private void writeObject(ObjectOutputStream s) throws IOException
| |