先来个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); } }
运行图: