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.