Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Problems HelloWorldSWT(Problems HelloWorldSWT)
Problems HelloWorldSWT [message #847799] Tue, 17 April 2012 17:08 Go to next message
Timo Schuster is currently offline Timo SchusterFriend
Messages: 1
Registered: April 2012
Junior Member
Hello, i have Problems with the HelloWorldSWT Example.

this are the errors
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:10)

and this is the java code:

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();
}

}

any idea? thanks Timo
Re: Problems HelloWorldSWT [message #871396 is a reply to message #847799] Sun, 13 May 2012 08:42 Go to previous message
David Winkworth is currently offline David WinkworthFriend
Messages: 1
Registered: May 2012
Junior Member
Running the risk of spoiling it for you, this is what your code should look like.

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();
		}
	}
Previous Topic:Could not open the editor: An exception was thrown during initialization
Next Topic:Exit code 13
Goto Forum:
  


Current Time: Thu Apr 25 01:30:31 GMT 2024

Powered by FUDForum. Page generated in 0.07698 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top