public interface FocusListener extends EventListener
FocusAdapter类(仅覆盖感兴趣的方法)。
然后,使用组件的addFocusListener方法将从该类创建的侦听器对象注册到组件。
当组分获得或失去键盘焦点,在收听对象中的相关方法被调用,并且FocusEvent被传递给它。
FocusAdapter , FocusEvent , Tutorial: Writing a Focus Listener
| Modifier and Type | Method and Description |
|---|---|
void |
focusGained(FocusEvent e)
当组件获得键盘焦点时调用。
|
void |
focusLost(FocusEvent e)
当组件丢失键盘焦点时调用。
|
void focusGained(FocusEvent e)
void focusLost(FocusEvent 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.