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