![]() ![]() For example, a window listener is used to save data before closing the window, or to exit the program when the last window closes.Ī user does not necessarily need to implement a window listener to specify what a window should do when the user closes it. Window listeners are commonly used to implement custom window-closing behavior. The WindowEventDemo example, described later in this section, shows how this method can be used. IsFrameStateSupported(int) can be used to determine whether a particular window state is supported by a particular window manager. Note: Not all window managers/native platforms support all window states. While you can use the WindowListener methods to detect some window states, such as iconification, there are two reasons why a WindowStateListener might be preferable: it has only one method for you to implement, and it provides support for maximization. WindowStateListener has a single method to detect a change to the state of the window, such as when the window is iconified, deiconified, maximized, or restored to normal. WindowFocusListener contains methods to detect when the window becomes the focus owner or it loses the focus owner status. The other two window listener interfaces are WindowFocusListener and WindowStateListener. The WindowListener interface defines methods that handle most window events, such as the events for opening and closing the window, activation and deactivation of the window, and iconification and deiconification of the window.
0 Comments
Leave a Reply. |