Draw2d 学习笔记一 helloworld



 先来个hellloworld入门啊。

 

public class HelloWorld {

	public static void main(String args[]) {
		Shell shell = new Shell();
		shell.setText("Draw2d Hello World");
		shell.pack();	shell.open();
		
		// create content 4 shell.
		createContent4Shell(shell);
		
		while (!shell.isDisposed ()) {
			if (!Display.getDefault().readAndDispatch ())
				Display.getDefault().sleep ();
		}
	}

	private static void createContent4Shell(Shell shell) {
		LightweightSystem lws = new LightweightSystem(shell);
		IFigure label = new Label("Hello World");
		lws.setContents(label);
	}
}

 运行图:



 

你可能感兴趣的:(helloworld)