List of usage examples for java.awt Frame ICONIFIED
int ICONIFIED
To view the source code for java.awt Frame ICONIFIED.
Click Source Link
From source file:Main.java
public static void main(String args[]) throws Exception { // Create a test frame Frame frame = new Frame("Hello"); frame.add(new Label("Minimize demo")); frame.pack();//from w w w .ja va 2s . c o m // Show the frame frame.setVisible(true); // Sleep for 5 seconds, then minimize Thread.sleep(5000); frame.setState(Frame.ICONIFIED); frame.setVisible(false); // Sleep for 5 seconds, then restore Thread.sleep(5000); frame.setState(Frame.NORMAL); frame.setVisible(true); // Sleep for 5 seconds, then kill window Thread.sleep(5000); frame.setVisible(false); frame.dispose(); // Terminate test System.exit(0); }
From source file:Main.java
public static void main(String[] args) throws InterruptedException { JFrame frame = new JFrame(); frame.add(new JLabel("Minimize demo")); frame.pack();//w ww . j a va2 s . co m // Show the frame frame.setVisible(true); // Sleep for 5 seconds, then minimize Thread.sleep(5000); frame.setState(Frame.ICONIFIED); // Sleep for 5 seconds, then restore Thread.sleep(5000); frame.setState(Frame.NORMAL); // Sleep for 5 seconds, then kill window Thread.sleep(5000); frame.setVisible(false); frame.dispose(); // Terminate test System.exit(0); }
From source file:com.raddle.tools.ClipboardTransferMain.java
/** * Auto-generated main method to display this JFrame *//*from w ww .j a v a 2s . co m*/ public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ClipboardTransferMain inst = new ClipboardTransferMain(); inst.setLocationRelativeTo(null); inst.setDefaultCloseOperation(EXIT_ON_CLOSE); if (args != null) { for (String string : args) { if ("-s".equals(string)) { inst.startServer(); } } for (String string : args) { if ("-m".equals(string)) { inst.setState(Frame.ICONIFIED); } } } if (inst.getState() != Frame.ICONIFIED) { inst.setVisible(true); } } }); }
From source file:Main.java
public static void iconify(Frame frame) { int state = frame.getExtendedState(); // Set the iconified bit state |= Frame.ICONIFIED; // Iconify the frame frame.setExtendedState(state);/*w ww. j a v a 2s . com*/ }
From source file:Main.java
public static void deiconify(Frame frame) { int state = frame.getExtendedState(); // Clear the iconified bit state &= ~Frame.ICONIFIED; // Deiconify the frame frame.setExtendedState(state);// w ww. j ava 2 s.co m }
From source file:Main.java
public static void main() { Frame frame = new Frame(); WindowStateListener listener = new WindowAdapter() { public void windowStateChanged(WindowEvent evt) { int oldState = evt.getOldState(); int newState = evt.getNewState(); if ((oldState & Frame.ICONIFIED) == 0 && (newState & Frame.ICONIFIED) != 0) { System.out.println("Frame was iconized"); } else if ((oldState & Frame.ICONIFIED) != 0 && (newState & Frame.ICONIFIED) == 0) { System.out.println("Frame was deiconized"); }//from www . j a va2 s . co m if ((oldState & Frame.MAXIMIZED_BOTH) == 0 && (newState & Frame.MAXIMIZED_BOTH) != 0) { System.out.println("Frame was maximized"); } else if ((oldState & Frame.MAXIMIZED_BOTH) != 0 && (newState & Frame.MAXIMIZED_BOTH) == 0) { System.out.println("Frame was minimized"); } } }; frame.addWindowStateListener(listener); frame.setVisible(true); }
From source file:Main.java
/** * Mostra uma caixa de menssagem para que seja ensirido um valor. * @param frame/* w w w.jav a 2 s .co m*/ * @param texto * @param title * @param valorInicial * @param type * @return * @author Thiago Benega * @since 13/04/2009 */ public static String showTextboxDialog(javax.swing.JFrame frame, String texto, String title, String valorInicial, int type) { Object txt = null; JDialog jDialog = new JDialog(); jDialog.setTitle(title); jDialog.setFocusableWindowState(true); if (frame != null) { frame.setExtendedState(Frame.ICONIFIED); frame.pack(); frame.setExtendedState(Frame.MAXIMIZED_BOTH); } switch (type) { case JOptionPane.OK_CANCEL_OPTION: txt = JOptionPane.showInputDialog(jDialog, texto, title, type, null, null, valorInicial);//.toString(); break; case JOptionPane.YES_NO_OPTION: txt = JOptionPane.showConfirmDialog(jDialog, texto, title, type, JOptionPane.INFORMATION_MESSAGE); break; default: JOptionPane.showMessageDialog(jDialog, texto, title, type); break; } jDialog = null; return txt != null ? txt.toString() : null; }
From source file:Main.java
public static boolean isMinimized(Frame f) { return (f.getExtendedState() & Frame.ICONIFIED) == Frame.ICONIFIED; }
From source file:Main.java
public void componentResized(ComponentEvent e) { System.out.println("componentResized"); if (getState() == Frame.ICONIFIED) { System.out.println("RESIZED TO ICONIFIED"); } else if (getState() == Frame.NORMAL) { System.out.println("RESIZED TO NORMAL"); } else {//w w w . ja va2 s . c o m System.out.println("RESIZED TO MAXIMIZED"); } }
From source file:Main.java
public Main() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel() { @Override//w w w. j av a 2s. c om public Dimension getPreferredSize() { return new Dimension(300, 300); } }; frame.add(panel); frame.addWindowStateListener(new WindowAdapter() { @Override public void windowStateChanged(WindowEvent we) { super.windowStateChanged(we); if (we.getNewState() == Frame.ICONIFIED) { System.out.println("Here"); } } }); frame.pack(); frame.setVisible(true); }