Example usage for java.awt Frame getExtendedState

List of usage examples for java.awt Frame getExtendedState

Introduction

In this page you can find the example usage for java.awt Frame getExtendedState.

Prototype

public int getExtendedState() 

Source Link

Document

Gets the state of this frame.

Usage

From source file:Main.java

public static void deiconify(Frame frame) {
    int state = frame.getExtendedState();

    // Clear the iconified bit
    state &= ~Frame.ICONIFIED;

    // Deiconify the frame
    frame.setExtendedState(state);/* www  . j  a  v a  2  s  . c  o  m*/
}

From source file:Main.java

public static void minimize(Frame frame) {
    int state = frame.getExtendedState();

    // Clear the maximized bits
    state &= ~Frame.MAXIMIZED_BOTH;

    // Maximize the frame
    frame.setExtendedState(state);// w  w  w  .j  a v  a  2s.  c o m
}

From source file:Main.java

public static void iconify(Frame frame) {
    int state = frame.getExtendedState();

    // Set the iconified bit
    state |= Frame.ICONIFIED;/*w w  w  .j  ava  2s . co m*/

    // Iconify the frame
    frame.setExtendedState(state);
}

From source file:Main.java

public static void maximize(Frame frame) {
    int state = frame.getExtendedState();

    // Set the maximized bits
    state |= Frame.MAXIMIZED_BOTH;

    // Maximize the frame
    frame.setExtendedState(state);//from w  w w.  ja  v  a 2 s . c o m
}

From source file:Main.java

public static boolean isMinimized(Frame f) {
    return (f.getExtendedState() & Frame.ICONIFIED) == Frame.ICONIFIED;
}

From source file:Main.java

/**
 * Gets the window actual size.//  w  w  w.j  a v  a 2  s .  c o m
 *
 * @param window
 *            the window
 * @return the window actual size
 */
public static Dimension getWindowActualSize(final Window window) {
    if (window.isVisible()) {
        return window.getSize();
    }
    if (window instanceof Frame) {
        final Frame frame = (Frame) window;
        if (frame.getExtendedState() == Frame.MAXIMIZED_BOTH) {
            return Toolkit.getDefaultToolkit().getScreenSize();
        }
    }
    return window.getSize();
}

From source file:org.paxle.desktop.impl.DialogueServices.java

private static void show(final Frame frame) {
    final int extstate = frame.getExtendedState();
    if ((extstate & Frame.ICONIFIED) == Frame.ICONIFIED)
        frame.setExtendedState(extstate ^ Frame.ICONIFIED);
    if (!frame.isVisible())
        frame.setVisible(true);/*from w ww.ja  v a  2  s  .  c  o m*/
    frame.toFront();
}