JavaTM 2 Platform
Standard Ed. 6

javax.swing
类 ComponentInputMap

java.lang.Object
  继承者 javax.swing.InputMap
      继承者 javax.swing.ComponentInputMap
所有已实现的接口:
Serializable
直接已知子类:
ComponentInputMapUIResource

public class ComponentInputMap
extends InputMap

ComponentInputMap 是与特定 JComponent 相关联的 InputMap。只要 ComponentInputMap 发生更改,该组件都将自动获得通知。ComponentInputMap 用于 WHEN_IN_FOCUSED_WINDOW 绑定。

从以下版本开始:
1.3

构造方法摘要
ComponentInputMap(JComponent component)
          创建一个与给定组件相关联的 ComponentInputMap
 
方法摘要
 void clear()
          从此对象中移除所有映射关系。
 JComponent getComponent()
          返回为其创建 InputMap 的组件。
 void put(KeyStroke keyStroke, Object actionMapKey)
          将一个 keyStroke 的绑定添加到 actionMapKey
 void remove(KeyStroke key)
          从此对象中移除 key 的绑定。
 void setParent(InputMap map)
          设置父组件,该组件必须是一个和与此 ComponentInputMap 相同的组件相关联的 ComponentInputMap
 
从类 javax.swing.InputMap 继承的方法
allKeys, get, getParent, keys, size
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ComponentInputMap

public ComponentInputMap(JComponent component)
创建一个与给定组件相关联的 ComponentInputMap

参数:
component - 一个非 null JComponent
抛出:
IllegalArgumentException - 如果 component 为 null
方法详细信息

setParent

public void setParent(InputMap map)
设置父组件,该组件必须是一个和与此 ComponentInputMap 相同的组件相关联的 ComponentInputMap

覆盖:
InputMap 中的 setParent
参数:
map - 一个 ComponentInputMap
抛出:
IllegalArgumentException - 如果 map 不是一个 ComponentInputMap 或者与相同的组件无关

getComponent

public JComponent getComponent()
返回为其创建 InputMap 的组件。


put

public void put(KeyStroke keyStroke,
                Object actionMapKey)
将一个 keyStroke 的绑定添加到 actionMapKey。如果 actionMapKey 为 null,则移除 keyStroke 的当前绑定。

覆盖:
InputMap 中的 put

remove

public void remove(KeyStroke key)
从此对象中移除 key 的绑定。

覆盖:
InputMap 中的 remove

clear

public void clear()
从此对象中移除所有映射关系。

覆盖:
InputMap 中的 clear

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策