Thursday, February 14, 2008

Hello World SWT

import org.eclipse.swt.widgets.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();
}

}

I followed another tutorial to create a small application. I downloaded the SWT (Standard Widget Toolkit) from Eclipse and once installed, it allowed me to generate an empty window with "Hello World" as the title.

No comments: