import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class WindowSWT { 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.setSize(300, 200); //width, height shell.setText("SWT Window"); //title bar ScrolledComposite c1 = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); 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(); } }