public abstract class FocusAdapter extends Object implements FocusListener
扩展此类以创建一个FocusEvent
监听器,并覆盖感兴趣事件的方法。 (如果您实现了FocusListener
接口,则必须定义其中的所有方法,这个抽象类为它们定义了空方法,因此您只能为所关心的事件定义方法。)
使用扩展类创建侦听器对象,然后使用组件的addFocusListener
方法将其注册到组件。 当组件增益或失去键盘焦点时,将调用侦听器对象中的相关方法,并将FocusEvent
传递给它。
FocusEvent
, FocusListener
, Tutorial: Writing a Focus Listener
Constructor and Description |
---|
FocusAdapter() |
public void focusGained(FocusEvent e)
focusGained
在接口
FocusListener
public void focusLost(FocusEvent e)
focusLost
中的
FocusListener
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.