I am trying to create a Hello World SWT application using Eclipse. I follow all instructions and in the end my program does not work.
This is my code:
import gnu.gcj.xlib.Display;
import org.eclipse.swt.widgets.Shell;
public class HelloWorldSWT {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
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();
}
}
And this is my error messages:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The constructor Shell(Display) is undefined
The method readAndDispatch() is undefined for the type Display
The method sleep() is undefined for the type Display
The method dispose() is undefined for the type Display
at HelloWorldSWT.main(HelloWorldSWT.java:13)
Does anybody know how I can check what is wrong?