public class InputMap extends Object implements Serializable
InputMap提供一个输入事件之间的绑定(使用了目前只有
KeyStrokes)和
Object。
InputMaps通常用一个
ActionMap,确定一个
Action执行当一个键被按下。一个
InputMap可以有一个父,是寻找在
InputMap未定义的绑定。
与ActionMap如果你创建了一个周期,如:
inputmap是新inputmap();inputmap BM =新inputmap():是Setparent(BM);BM Setparent(AM);一些方法会导致堆栈溢出错误被抛出。
| Constructor and Description |
|---|
InputMap()
创建一个没有父母,没有
InputMap映射。
|
| Modifier and Type | Method and Description |
|---|---|
KeyStroke[] |
allKeys()
返回在这
InputMap及其母
KeyStrokes数组定义。
|
void |
clear()
除去这
InputMap所有映射。
|
Object |
get(KeyStroke keyStroke)
返回绑定消息
keyStroke,母
InputMap如果结合不确定。
|
InputMap |
getParent()
得到这个
InputMap的母。
|
KeyStroke[] |
keys()
返回被绑定在这
InputMap的
KeyStrokes。
|
void |
put(KeyStroke keyStroke, Object actionMapKey)
添加一个绑定到
actionMapKey
keyStroke。
|
void |
remove(KeyStroke key)
删除绑定从这
InputMap
key。
|
void |
setParent(InputMap map)
这一集
InputMap的母。
|
int |
size()
返回
KeyStroke绑定的号码。
|
public void setParent(InputMap map)
InputMap的母。
map -
InputMap是这一母
public InputMap getParent()
InputMap的母。
InputMap,是这一个家长,或null如果这
InputMap没有父
public void put(KeyStroke keyStroke, Object actionMapKey)
actionMapKey
keyStroke。如果
actionMapKey是null,这消除
keyStroke当前绑定的。
public void remove(KeyStroke key)
InputMap
key。
public void clear()
InputMap所有映射。
public KeyStroke[] keys()
InputMap的
KeyStrokes。
public int size()
KeyStroke绑定的号码。
public KeyStroke[] allKeys()
InputMap及其母
KeyStrokes数组定义。这不同于
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.