InputMap
provides a binding between an input event (currently only
KeyStroke
s are used) and an Object
. InputMap
s are
usually used with an ActionMap
, to determine an Action
to
perform when a key is pressed. An InputMap
can have a parent that
is searched for bindings not defined in the InputMap
.
As with ActionMap
if you create a cycle, eg:
InputMap am = new InputMap(); InputMap bm = new InputMap(): am.setParent(bm); bm.setParent(am);some of the methods will cause a StackOverflowError to be thrown.
Modifier and Type | Field and Description |
---|---|
private transient ArrayTable | arrayTable
Handles the mapping between KeyStroke and Action name. |
private InputMap | parent
Parent that handles any bindings we don't contain. |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public KeyStroke[] | Returns: an array of theKeyStroke s defined in this
InputMap and its parentReturns an array of the |
public void | |
public Object | |
public InputMap | Returns: map theInputMap that is the parent of this one,
or null if this InputMap has no parentGets this |
public KeyStroke[] | Returns: an array of theKeyStroke s that are bound in this
InputMap Returns the |
public void | |
private void | |
public void | |
public void | |
public int | |
private void |
arrayTable | back to summary |
---|---|
private transient ArrayTable arrayTable Handles the mapping between KeyStroke and Action name. |
parent | back to summary |
---|---|
private InputMap parent Parent that handles any bindings we don't contain. |
InputMap | back to summary |
---|---|
public InputMap() Creates an |
allKeys | back to summary |
---|---|
public KeyStroke[] allKeys() Returns an array of the
|
clear | back to summary |
---|---|
public void clear() Removes all the mappings from this |
get | back to summary |
---|---|
public Object get(KeyStroke keyStroke) Returns the binding for |
getParent | back to summary |
---|---|
public InputMap getParent() Gets this
|
keys | back to summary |
---|---|
public KeyStroke[] keys() Returns the
|
put | back to summary |
---|---|
public void put(KeyStroke keyStroke, Object actionMapKey) Adds a binding for |
readObject | back to summary |
---|---|
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException
|
remove | back to summary |
---|---|
public void remove(KeyStroke key) Removes the binding for
|
setParent | back to summary |
---|---|
public void setParent(InputMap map) Sets this
|
size | back to summary |
---|---|
public int size() Returns the number of
|
writeObject | back to summary |
---|---|
private void writeObject(ObjectOutputStream s) throws IOException
|