Maximizes a frame; the iconified bit is not affected : JFrame States « Swing « Java Tutorial






import java.awt.Frame;

public class Main {
  public static void main(String[] argv) throws Exception {
    Frame frame = new Frame();

    frame.setSize(300, 300);
    frame.setVisible(true);

    minimize(frame);
  }

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

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

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








14.81.JFrame States
14.81.1.Setting the Bounds for a Maximized Frame
14.81.2.Iconifies a frame; the maximized bits are not affected.
14.81.3.Deiconifies a frame; the maximized bits are not affected.
14.81.4.Maximizes a frame; the iconified bit is not affected
14.81.5.Determining When a Frame or Window Is Opened or Closed
14.81.6.Determining When a Frame or Window Is Iconized or Maximized
14.81.7.Determining When a Component Has Been Made Visible, Moved, or Resized