当前位置:编程学习 > JSP >>

Draw2D--1. 设计思想和相关模式

1.  Draw2d 设计思想 Draw2d是一个宿主在SWT Composite控件中的轻量级的构件(widge)系统。一个Draw2d应用程序由一个 SWT Composite控件, 一个轻量级系统, 以及其内容(figures)组成。Figures是Draw2d的建造块。下面的“Hello World”例子程序演示了如何实现一个最简单的draw2d程序。Listing for "Hello World"
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.SWT;
import org.eclipse.draw2d.*;
import org.eclipse.draw2d.geometry.*;
public class HelloWorld {
         public static void main(String args[]){
                 Shell shell = new Shell();
                 shell.open();
                 shell.setText("Draw2d Hello World");
                 LightweightSystem lws = new LightweightSystem(shell);
                 IFigure label = new Label("Hello World");
                 lws.setContents(label); //设置内容
                 Display display = Display.getDefault();
                 while (!shell.isDisposed ()) {
                          if (!display.readAndDispatch ())
                                   display.sleep ();
补充:Jsp教程,Java技巧及代码
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,