Mega Code Archive

 
Categories / Java Tutorial / SWT
 

Shell States

A shell is always displayed in one of the following states: Normal, Maximized, Minimized. To minimize a shell, you can use the following method: public void setMinimized(boolean minimized) import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class ShellStates {   public static void main(String[] args) {     final Display display = new Display();     final Shell shell = new Shell(display,SWT.SHELL_TRIM);     shell.setLayout(new FillLayout());          shell.setMinimized(true);     shell.open();     // Set up the event loop.     while (!shell.isDisposed()) {       if (!display.readAndDispatch()) {         // If no more entries in event queue         display.sleep();       }     }     display.dispose();   } } To check whether a shell is minimized or not, use: public boolean getMinimized() The counterparts methods for the maximized state are as follows: public void setMaximized(boolean maximized)      public boolean getMaximized()