public interface KeyListener extends EventListener
KeyAdapter类(仅覆盖感兴趣的方法)。
然后,使用该组件的addKeyListener方法将从该类创建的侦听器对象注册到组件。 按键,释放或键入时会产生键盘事件。 然后调用侦听器对象中的相关方法,并将KeyEvent传递给它。
KeyAdapter , KeyEvent , Tutorial: Writing a Key Listener
| Modifier and Type | Method and Description |
|---|---|
void |
keyPressed(KeyEvent e)
按下键时调用。
|
void |
keyReleased(KeyEvent e)
当键已被释放时调用。
|
void |
keyTyped(KeyEvent e)
键入键时调用。
|
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.