public abstract class WindowAdapter extends Object implements WindowListener, WindowStateListener, WindowFocusListener
扩展此类以创建一个WindowEvent
监听器,并覆盖感兴趣的事件的方法。 (如果您实现了WindowListener
接口,则必须定义其中的所有方法,这个抽象类为它们定义了空方法,因此您只能为所关心的事件定义方法。)
使用扩展类创建侦听器对象,然后使用窗口的addWindowListener
方法将其注册到窗口。 当窗口的状态由于打开,关闭,激活或停用,图标化或去隐藏而改变时,将调用侦听器对象中的相关方法,并将WindowEvent
传递给它。
WindowEvent
, WindowListener
, Tutorial: Writing a Window Listener
Constructor and Description |
---|
WindowAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
windowActivated(WindowEvent e)
激活窗口时调用。
|
void |
windowClosed(WindowEvent e)
当窗口关闭时调用。
|
void |
windowClosing(WindowEvent e)
当窗口处于关闭状态时调用。
|
void |
windowDeactivated(WindowEvent e)
当窗口被禁用时调用。
|
void |
windowDeiconified(WindowEvent e)
当窗口被去图标化时调用。
|
void |
windowGainedFocus(WindowEvent e)
当窗口设置为聚焦窗口时调用,这意味着窗口或其子组件之一将接收键盘事件。
|
void |
windowIconified(WindowEvent e)
当窗口被图标化时调用。
|
void |
windowLostFocus(WindowEvent e)
当窗口不再是聚焦窗口时调用,这意味着键盘事件将不再传递到窗口或其任何子组件。
|
void |
windowOpened(WindowEvent e)
当窗口打开时调用。
|
void |
windowStateChanged(WindowEvent e)
当窗口状态改变时调用。
|
public void windowOpened(WindowEvent e)
windowOpened
在界面
WindowListener
public void windowClosing(WindowEvent e)
windowClosing
在界面
WindowListener
public void windowClosed(WindowEvent e)
windowClosed
在界面
WindowListener
public void windowIconified(WindowEvent e)
windowIconified
在界面
WindowListener
Frame.setIconImage(java.awt.Image)
public void windowDeiconified(WindowEvent e)
windowDeiconified
在界面
WindowListener
public void windowActivated(WindowEvent e)
windowActivated
在界面
WindowListener
public void windowDeactivated(WindowEvent e)
windowDeactivated
在界面
WindowListener
public void windowStateChanged(WindowEvent e)
windowStateChanged
在界面
WindowStateListener
public void windowGainedFocus(WindowEvent e)
windowGainedFocus
在界面
WindowFocusListener
public void windowLostFocus(WindowEvent e)
windowLostFocus
在界面
WindowFocusListener
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.