public class ActionMap extends Object implements Serializable
ActionMap提供从Object s(称为密钥或Action名称 )到Action 。
ActionMap通常与InputMap一起使用来定位按键时的特定动作。
与InputMap ,一个ActionMap可以有一个父级,搜索ActionMap未定义的ActionMap 。
与InputMap如果你创建一个循环,例如:
ActionMap am = new ActionMap();
ActionMap bm = new ActionMap():
am.setParent(bm);
bm.setParent(am);
一些方法将导致抛出一个StackOverflowError。
InputMap
| Constructor and Description |
|---|
ActionMap()
创建一个
ActionMap没有父母和没有映射。
|
| Modifier and Type | Method and Description |
|---|---|
Object[] |
allKeys()
返回此
ActionMap及其父
ActionMap定义的键的数组。
|
void |
clear()
从这个
ActionMap删除所有的映射。
|
Action |
get(Object key)
返回
key的绑定,如果绑定未在本地定义,则发送父母
ActionMap 。
|
ActionMap |
getParent()
返回这个
ActionMap的父母。
|
Object[] |
keys()
返回
Action了在这个约束的名字
ActionMap 。
|
void |
put(Object key, Action action)
将
key的绑定添加到
action 。
|
void |
remove(Object key)
从
ActionMap删除
key的绑定。
|
void |
setParent(ActionMap map)
设置此
ActionMap的父级。
|
int |
size()
返回此
ActionMap中绑定的数量。
|
public void setParent(ActionMap map)
ActionMap的父母。
map - 这是一个父母的
ActionMap
public ActionMap getParent()
ActionMap的父母。
ActionMap是这个的父母,或null如果这个
ActionMap没有父
public void put(Object key, Action action)
key的绑定添加到action 。
如果action为空,则将删除key的当前绑定。
在大多数情况下, key将为action.getValue(NAME) 。
public void remove(Object key)
ActionMap删除
key的绑定。
public void clear()
ActionMap删除所有的映射。
public Object[] keys()
Action了在这个约束的名字
ActionMap 。
public int size()
ActionMap中的绑定数。
ActionMap
public Object[] allKeys()
ActionMap及其父级中定义的键的数组。
该方法与keys()的不同之处在于,该方法包括父项中定义的键。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.