1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
public class HelloWorldSWT {
Composite plan;
public void run(){
Display display = new Display ();
final Shell shell = new Shell(display);
plan = new Composite(shell,SWT.NO_REDRAW_RESIZE);
plan.setBounds(0,0,300,200);
Label label = new Label(plan,SWT.VERTICAL);
label.setText("Hello!");
shell.pack();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
public static void main (String [] args) {
new HelloWorldSWT().run();
}
} |