import java.awt.Frame; public class Main { public static void main() { Frame frame = new Frame(); frame.setSize(300, 300); frame.setVisible(true); iconify(frame); } public static void iconify(Frame frame) { int state = frame.getExtendedState(); // Set the iconified bit state |= Frame.ICONIFIED; // Iconify the frame frame.setExtendedState(state); } }