JavaTM 2 Platform
Standard Ed. 6

类 java.awt.event.KeyEvent
的使用

使用 KeyEvent 的软件包
java.awt 包含用于创建用户界面和绘制图形图像的所有类。 
java.awt.event 提供处理由 AWT 组件所激发的各类事件的接口和类。 
javax.swing 提供一组“轻量级”(全部是 Java 语言)组件,尽量让这些组件在所有平台上的工作方式都相同。 
javax.swing.event 供 Swing 组件触发的事件使用。 
javax.swing.plaf.basic 提供了根据基本外观构建的用户界面对象。 
 

java.awtKeyEvent 的使用
 

参数类型为 KeyEventjava.awt 中的方法
 boolean DefaultKeyboardFocusManager.dispatchKeyEvent(KeyEvent e)
          如果调度程序链中其他 KeyEventDispatcher 都没有调度 KeyEvent,或者没有注册其他 KeyEventDispatcher,则由 dispatchEvent 调用此方法。
abstract  boolean KeyboardFocusManager.dispatchKeyEvent(KeyEvent e)
          通常情况下,如果该指派程序链中的其他 KeyEventDispatcher 没有指派 KeyEvent 或者没有注册其他 KeyEventDispatcher,则 dispatchEvent 将调用此方法。
 boolean KeyEventDispatcher.dispatchKeyEvent(KeyEvent e)
          当前 KeyboardFocusManager 调用此方法,请求此 KeyEventDispatcher 为其指派指定的事件。
static AWTKeyStroke AWTKeyStroke.getAWTKeyStrokeForEvent(KeyEvent anEvent)
          返回一个 AWTKeyStroke,它表示生成给定 KeyEvent 的键击事件。
 void AWTEventMulticaster.keyPressed(KeyEvent e)
          通过在侦听器 a 和侦听器 b 上调用 keyPressed 方法处理 keyPressed 事件。
 void AWTEventMulticaster.keyReleased(KeyEvent e)
          通过在侦听器 a 和侦听器 b 上调用 keyReleased 方法处理 keyReleased 事件。
 void AWTEventMulticaster.keyTyped(KeyEvent e)
          通过在侦听器 a 和侦听器 b 上调用 keyTyped 方法处理 keyTyped 事件。
 boolean DefaultKeyboardFocusManager.postProcessKeyEvent(KeyEvent e)
          由 dispatchKeyEvent 调用此方法。
abstract  boolean KeyboardFocusManager.postProcessKeyEvent(KeyEvent e)
          dispatchKeyEvent 将调用此方法。
 boolean KeyEventPostProcessor.postProcessKeyEvent(KeyEvent e)
          当前 KeyboardFocusManager 调用此方法,请求此 KeyEventPostProcessor 执行应该作为 KeyEvent 最终解析的一部分的所需后处理。
 void DefaultKeyboardFocusManager.processKeyEvent(Component focusedComponent, KeyEvent e)
          当且仅当该 KeyEvent 表示指定 focusedComponent 的焦点遍历键时,此方法才会启动一个焦点遍历操作。
abstract  void KeyboardFocusManager.processKeyEvent(Component focusedComponent, KeyEvent e)
          当且仅当该 KeyEvent 表示指定 focusedComponent 的焦点遍历键时,此方法启动焦点遍历操作。
protected  void Component.processKeyEvent(KeyEvent e)
          处理组件上发生的按键事件,方法是将其指派到任意已注册的 KeyListener 对象。
 

java.awt.eventKeyEvent 的使用
 

参数类型为 KeyEventjava.awt.event 中的方法
 void KeyAdapter.keyPressed(KeyEvent e)
          按下某个键时调用此方法。
 void KeyListener.keyPressed(KeyEvent e)
          按下某个键时调用此方法。
 void KeyAdapter.keyReleased(KeyEvent e)
          释放某个键时调用此方法。
 void KeyListener.keyReleased(KeyEvent e)
          释放某个键时调用此方法。
 void KeyAdapter.keyTyped(KeyEvent e)
          键入某个键时调用此方法。
 void KeyListener.keyTyped(KeyEvent e)
          键入某个键时调用此方法。
 

javax.swingKeyEvent 的使用
 

参数类型为 KeyEventjavax.swing 中的方法
static KeyStroke KeyStroke.getKeyStrokeForEvent(KeyEvent anEvent)
          返回一个 KeyStroke,它表示生成给定 KeyEvent 的快捷键事件。
static boolean SwingUtilities.notifyAction(Action action, KeyStroke ks, KeyEvent event, Object sender, int modifiers)
          如果启用 action(且为非 null),则调用 action 上的 actionPerformed
protected  void JComponent.processComponentKeyEvent(KeyEvent e)
          处理该组件本身可识别的所有键事件。
protected  boolean JTable.processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
           
protected  boolean JMenuBar.processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
          子类化以检查所有子菜单。
protected  boolean JComponent.processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
          由于发生 KeyEvent e 而调用此方法处理 ks 的键绑定。
static boolean SwingUtilities.processKeyBindings(KeyEvent event)
          处理与 event 关联的 Component 的键绑定。
 void JComboBox.processKeyEvent(KeyEvent e)
          处理 KeyEvent,查找 Tab 键。
 void MenuSelectionManager.processKeyEvent(KeyEvent e)
          当 MenuElement 从 KeyListener 接收事件时,它决不应直接处理该事件。
protected  void JPopupMenu.processKeyEvent(KeyEvent evt)
          处理快捷键事件,如助记符和加速器。
protected  void JMenu.processKeyEvent(KeyEvent evt)
          处理键击事件,如助记符和加速器。
protected  void JComponent.processKeyEvent(KeyEvent e)
          重写 processKeyEvent 以处理事件。
 void JPopupMenu.processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager)
          如有必要,通过使用 MenuSelectionManager 的 API 处理从 MenuSelectionManager 转发的键事件并更改菜单选择。
 void JMenuBar.processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager)
          实现为 MenuElement(不执行任何操作)。
 void JMenuItem.processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager)
          如有必要,通过使用 MenuSelectionManager 的 API 处理从 MenuSelectionManager 转发的键事件并更改菜单选择。
 void MenuElement.processKeyEvent(KeyEvent event, MenuElement[] path, MenuSelectionManager manager)
          处理键事件。
 

javax.swing.eventKeyEvent 的使用
 

javax.swing.eventKeyEvent 的子类
 class MenuKeyEvent
          MenuKeyEvent 用于通知感兴趣的参与者菜单元素已在菜单树中接收转发给它的 KeyEvent。
 

javax.swing.plaf.basicKeyEvent 的使用
 

参数类型为 KeyEventjavax.swing.plaf.basic 中的方法
 void BasicTreeUI.KeyHandler.keyPressed(KeyEvent e)
           
 void BasicTableUI.KeyHandler.keyPressed(KeyEvent e)
           
 void BasicComboBoxUI.KeyHandler.keyPressed(KeyEvent e)
           
 void BasicTreeUI.KeyHandler.keyReleased(KeyEvent e)
           
 void BasicTableUI.KeyHandler.keyReleased(KeyEvent e)
           
 void BasicComboPopup.InvocationKeyHandler.keyReleased(KeyEvent e)
           
 void BasicTreeUI.KeyHandler.keyTyped(KeyEvent e)
          键入键时调用。
 void BasicTableUI.KeyHandler.keyTyped(KeyEvent e)
           
 


JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only