文档

Java™ 教程-Java Tutorials 中文版
如何编写窗口监听器
Trail: Creating a GUI With JFC/Swing
Lesson: Writing Event Listeners
Section: Implementing Listeners for Commonly Handled Events

如何编写窗口监听器

This section explains how to implement three kinds of window-related event handlers: WindowListener, WindowFocusListener, and WindowStateListener. All three listeners handle WindowEvent objects. The methods in all three event handlers are implemented by the abstract WindowAdapter class.

When the appropriate listener has been registered on a window (such as a frame or dialog), window events are fired just after the window activity or state has occurred. A window is considered as a "focus owner", if this window receives keyboard input.

The following window activities or states can precede a window event:


Previous page: How to Write an Undoable Edit Listener
Next page: Listener API Table