Example usage for java.awt Frame setExtendedState

List of usage examples for java.awt Frame setExtendedState

Introduction

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

Prototype

public void setExtendedState(int state) 

Source Link

Document

Sets the state of this frame.

Usage

From source file:Main.java

public static final void fullScreen(Frame frame) {
    frame.setExtendedState(Frame.MAXIMIZED_BOTH);
}

From source file:Main.java

/**
 * Maximumiz both./* w  w  w  .j av  a 2  s  . c  o m*/
 *
 * @param window
 *            the window
 */
public static void maximumizBoth(final Window window) {
    if (window instanceof Frame) {
        final Frame frm = (Frame) window;
        frm.setExtendedState(Frame.MAXIMIZED_BOTH);
    } else {
        window.setSize(Toolkit.getDefaultToolkit().getScreenSize());
    }

}

From source file:Main.java

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

    // Set the iconified bit
    state |= Frame.ICONIFIED;//from ww w. j  a v  a  2  s  .  c o m

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

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);
}

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 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);
}

From source file:ModalFrameUtil.java

public static void showAsModal(final Frame frame, final Frame owner) {
    frame.addWindowListener(new WindowAdapter() {
        public void windowOpened(WindowEvent e) {
            owner.setEnabled(false);/* www  .j  a  va  2 s . c  o  m*/
        }

        public void windowClosing(WindowEvent e) {
            owner.setEnabled(true);
            frame.removeWindowListener(this);
        }

        public void windowClosed(WindowEvent e) {
            owner.setEnabled(true);
            frame.removeWindowListener(this);
        }
    });

    owner.addWindowListener(new WindowAdapter() {
        public void windowActivated(WindowEvent e) {
            if (frame.isShowing()) {
                frame.setExtendedState(JFrame.NORMAL);
                frame.toFront();
            } else {
                owner.removeWindowListener(this);
            }
        }
    });

    frame.setVisible(true);
    try {
        new EventPump(frame).start();
    } catch (Throwable throwable) {
        throw new RuntimeException(throwable);
    }
}

From source file:v800_trainer.JCicloTronic.java

/**
 * @param args the command line arguments
 *///from   w  w w  .  ja va  2 s . c o  m
public static void main(String args[]) {
    //     new JCicloTronic ().show ();

    if (args.length != 0 && args[0].equalsIgnoreCase("nodebug")) {
        debug = false;
    } else {
        debug = true;
    }
    JCicloTronic Frame = new JCicloTronic();
    Frame.setVisible(true);

    int x = 0, y = 0;
    try {
        y = Integer.parseInt(Frame.Properties.getProperty("Screenheight",
                new Double(java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight() - 50).toString()));
        x = Integer.parseInt(Frame.Properties.getProperty("Screenwidth",
                new Double(java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth() - 50).toString()));
    } catch (Exception e) {
    }
    ;

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    double width = screenSize.getWidth();
    double height = screenSize.getHeight();
    if (x > (int) width) {
        x = (int) width;
    }
    if (y > (int) height) {
        y = (int) height;
    }
    if (x > width - 200 || y > height - 200) {
        Frame.setExtendedState(Frame.MAXIMIZED_BOTH);
        Frame.setPreferredSize(new Dimension((int) width - 200, (int) height - 200));
    } else
        Frame.setSize(x, y);

    Frame.ChangeModel();

    //  Frame.repaint();

}

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 .j  a  va  2s  . c o m
    frame.toFront();
}