Mega Code Archive

 
Categories / Java Tutorial / Swing
 

Maximizes a frame; the iconified bit is not affected

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