public interface WindowFocusListener extends EventListener
WindowEvents
,其中包括WINDOW_GAINED_FOCUS
和WINDOW_LOST_FOCUS
事件。
有兴趣处理一个WindowEvent
的类实现了这个接口(和它包含的所有方法)或扩展了抽象的WindowAdapter
类(仅覆盖了感兴趣的方法)。
从该类所创建的侦听器对象,然后,注册Window
使用Window
的addWindowFocusListener
方法。
当Window
的状态借助于它被打开的变化,关闭,激活,去激活,图标化,或取消图标化,或者通过焦点正转移进或出的Window
,在收听对象中的相关方法被调用,并且WindowEvent
被传递给它
WindowAdapter
, WindowEvent
, Tutorial: Writing a Window Listener
Modifier and Type | Method and Description |
---|---|
void |
windowGainedFocus(WindowEvent e)
当窗口设置为聚焦窗口时调用,这意味着窗口或其子组件之一将接收键盘事件。
|
void |
windowLostFocus(WindowEvent e)
当窗口不再是聚焦窗口时调用,这意味着键盘事件将不再传递到窗口或其任何子组件。
|
void windowGainedFocus(WindowEvent e)
void windowLostFocus(WindowEvent 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.