HelloWorldSWT tutorial [message #906941] |
Sun, 02 September 2012 21:31  |
Eclipse User |
|
|
|
Yes, I'm new to Java and Eclipse (an incredible tool!).
I walked through the tutorial to build HelloWorld! and it worked. Then I tried walking through the tutorial for HelloWorldSWT. When I had problems, I deleted the HelloWorldSWT project and started over, I let the tutorial "do it for me" as much as possible.
But it still doesn't work.
I've tried the Organize Imports and can see no change. Where would I look to see the changes from this command?
Here's the code for the HelloWorldSWT.java:
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();
}
}
Here's the errors after I compile:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Display cannot be resolved to a type
Display cannot be resolved to a type
Shell cannot be resolved to a type
Shell cannot be resolved to a type
at HelloWorldSWT.main(HelloWorldSWT.java:9)
The tutorial says:
You will get compile errors. Right click in the Java editor and select Source > Organize Imports, then save your changes.
I've done this. Many times. I've tried the ctrl+shift+o and I still get the compile errors.
Why does this not work?
I really appreciate any help you can give me. Thank you!
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09092 seconds