Mega Code Archive

 
Categories / Java / Swing JFC
 

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);     maximize(frame);   }   public static void maximize(Frame frame) {     int state = frame.getExtendedState();     // Set the maximized bits     state |= Frame.MAXIMIZED_BOTH;     // Maximize the frame     frame.setExtendedState(state);   } }