javax.swing
Class ActionMap

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.ActionMap
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable
Direct Known Subclasses:
ActionMapUIResource sample code for javax.swing.plaf.ActionMapUIResource definition code for javax.swing.plaf.ActionMapUIResource

public class ActionMap
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Serializable sample code for java.io.Serializable definition code for java.io.Serializable

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.

See Also:
InputMap sample code for javax.swing.InputMap definition code for javax.swing.InputMap , Serialized Form

Constructor Summary
ActionMap sample code for javax.swing.ActionMap.ActionMap() definition code for javax.swing.ActionMap.ActionMap() ()
          Creates an ActionMap with no parent and no mappings.
 
Method Summary
 Object sample code for java.lang.Object definition code for java.lang.Object [] allKeys sample code for javax.swing.ActionMap.allKeys() definition code for javax.swing.ActionMap.allKeys() ()
          Returns an array of the keys defined in this ActionMap and its parent.
 void clear sample code for javax.swing.ActionMap.clear() definition code for javax.swing.ActionMap.clear() ()
          Removes all the mappings from this ActionMap.
 Action sample code for javax.swing.Action definition code for javax.swing.Action get sample code for javax.swing.ActionMap.get(java.lang.Object) definition code for javax.swing.ActionMap.get(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  key)
          Returns the binding for key, messaging the parent ActionMap if the binding is not locally defined.
 ActionMap sample code for javax.swing.ActionMap definition code for javax.swing.ActionMap getParent sample code for javax.swing.ActionMap.getParent() definition code for javax.swing.ActionMap.getParent() ()
          Returns this ActionMap's parent.
 Object sample code for java.lang.Object definition code for java.lang.Object [] keys sample code for javax.swing.ActionMap.keys() definition code for javax.swing.ActionMap.keys() ()
          Returns the Action names that are bound in this ActionMap.
 void put sample code for javax.swing.ActionMap.put(java.lang.Object, javax.swing.Action) definition code for javax.swing.ActionMap.put(java.lang.Object, javax.swing.Action) (Object sample code for java.lang.Object definition code for java.lang.Object  key, Action sample code for javax.swing.Action definition code for javax.swing.Action  action)
          Adds a binding for key to action.
 void remove sample code for javax.swing.ActionMap.remove(java.lang.Object) definition code for javax.swing.ActionMap.remove(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  key)
          Removes the binding for key from this ActionMap.
 void setParent sample code for javax.swing.ActionMap.setParent(javax.swing.ActionMap) definition code for javax.swing.ActionMap.setParent(javax.swing.ActionMap) (ActionMap sample code for javax.swing.ActionMap definition code for javax.swing.ActionMap  map)
          Sets this ActionMap's parent.
 int size sample code for javax.swing.ActionMap.size() definition code for javax.swing.ActionMap.size() ()
          Returns the number of KeyStroke bindings.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

ActionMap sample code for javax.swing.ActionMap() definition code for javax.swing.ActionMap()

public ActionMap()
Creates an ActionMap with no parent and no mappings.

Method Detail

setParent sample code for javax.swing.ActionMap.setParent(javax.swing.ActionMap) definition code for javax.swing.ActionMap.setParent(javax.swing.ActionMap)

public void setParent(ActionMap sample code for javax.swing.ActionMap definition code for javax.swing.ActionMap  map)
Sets this ActionMap's parent.

Parameters:
map - the ActionMap that is the parent of this one

getParent sample code for javax.swing.ActionMap.getParent() definition code for javax.swing.ActionMap.getParent()

public ActionMap sample code for javax.swing.ActionMap definition code for javax.swing.ActionMap  getParent()
Returns this ActionMap's parent.

Returns:
the ActionMap that is the parent of this one, or null if this ActionMap has no parent

put sample code for javax.swing.ActionMap.put(java.lang.Object, javax.swing.Action) definition code for javax.swing.ActionMap.put(java.lang.Object, javax.swing.Action)

public void put(Object sample code for java.lang.Object definition code for java.lang.Object  key,
                Action sample code for javax.swing.Action definition code for javax.swing.Action  action)
Adds a binding for key to action. If action is null, this removes the current binding for key.

In most instances, key will be action.getValue(NAME).


get sample code for javax.swing.ActionMap.get(java.lang.Object) definition code for javax.swing.ActionMap.get(java.lang.Object)

public Action sample code for javax.swing.Action definition code for javax.swing.Action  get(Object sample code for java.lang.Object definition code for java.lang.Object  key)
Returns the binding for key, messaging the parent ActionMap if the binding is not locally defined.


remove sample code for javax.swing.ActionMap.remove(java.lang.Object) definition code for javax.swing.ActionMap.remove(java.lang.Object)

public void remove(Object sample code for java.lang.Object definition code for java.lang.Object  key)
Removes the binding for key from this ActionMap.


clear sample code for javax.swing.ActionMap.clear() definition code for javax.swing.ActionMap.clear()

public void clear()
Removes all the mappings from this ActionMap.


keys sample code for javax.swing.ActionMap.keys() definition code for javax.swing.ActionMap.keys()

public Object sample code for java.lang.Object definition code for java.lang.Object [] keys()
Returns the Action names that are bound in this ActionMap.


size sample code for javax.swing.ActionMap.size() definition code for javax.swing.ActionMap.size()

public int size()
Returns the number of KeyStroke bindings.


allKeys sample code for javax.swing.ActionMap.allKeys() definition code for javax.swing.ActionMap.allKeys()

public Object sample code for java.lang.Object definition code for java.lang.Object [] allKeys()
Returns an array of the keys defined in this ActionMap and its parent. This method differs from keys() in that this method includes the keys defined in the parent.