//The following two lines are needed to open and close an SWT window. import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class HelloWorldSWT { public static void main(String[] args) { //The following two lines are needed to open an SWT window. Display display = new Display(); Shell shell = new Shell(display); shell.setText("Hello world!"); //title bar shell.open(); //Open the window (i.e., make it visible). //The following six lines are needed to close the SWT window. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }