Launch the eclipse.exe application by double-clicking on it. Click on the green checkmark to go to Tutorials. Click on Create a Hello World SWT application.
The right panel contains series of nine steps marked with isosceles right triangles. Here are hints to help you follow them.
Display display = new Display(); Shell shell = new Shell(display); shell.setText("Hello world!"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose();
When you have pasted in the statements, the words Display and Shell (two copies of each) should be underlined in zigzag red. Select Source → Organize Imports to add the following two import statements to your HelloWorldSWT.java file above your class.
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell;import declarations will also appear in the Outline.
Ambitious people can insert the following immediately below the shell.open(); statement. If Source → Organize Imports asks you which type of Label to import, select org.eclipse.swt.widgets.Label.
Label label = new Label(shell, SWT.BORDER); label.setText("This is a label."); label.setBounds(20, 20, 100, 40);