Example usage for java.awt.event WindowEvent WINDOW_STATE_CHANGED

List of usage examples for java.awt.event WindowEvent WINDOW_STATE_CHANGED

Introduction

In this page you can find the example usage for java.awt.event WindowEvent WINDOW_STATE_CHANGED.

Prototype

int WINDOW_STATE_CHANGED

To view the source code for java.awt.event WindowEvent WINDOW_STATE_CHANGED.

Click Source Link

Document

The window-state-changed event type.

Usage

From source file:Main.java

protected void processWindowEvent(WindowEvent e) {
    if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
        System.out.println(WindowEvent.WINDOW_STATE_CHANGED);
        dispose();/*from  w ww . ja va 2s . c o  m*/
        System.exit(0);
    }
    super.processWindowEvent(e); // Pass on the event
}

From source file:studio.ui.Studio.java

public void windowStateChanged(WindowEvent event) {
    if (event.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
        try {/*from ww  w.  j a v  a  2 s  .co  m*/
            studioConfig.setMaximized((event.getNewState() & JFrame.MAXIMIZED_BOTH) == JFrame.MAXIMIZED_BOTH);
        } catch (ConfigException ignored) {
        }
    }
}