draw2d的布局
来源:互联网 发布:最小公倍数 c语言 编辑:程序博客网 时间:2024/05/25 12:22
测试:
。
package test.draw2d.layout;import org.eclipse.draw2d.BorderLayout;public class LayoutShell extends Shell {/** * Launch the application. * * @param args */public static void main(String args[]) {try {Display display = Display.getDefault();LayoutShell shell = new LayoutShell(display);shell.open();shell.layout();while (!shell.isDisposed()) {if (!display.readAndDispatch()) {display.sleep();}}} catch (Exception e) {e.printStackTrace();}}/** * Create the shell. * * @param display */public LayoutShell(Display display) {super(display, SWT.SHELL_TRIM);createContents();}/** * Create contents of the shell. */protected void createContents() {setText("SWT Application draw2d");setSize(400, 400);setLayout(new FillLayout());LightweightSystem lws = new LightweightSystem(this);Figure canvas = new Figure();BorderLayout borderLayout = new BorderLayout();borderLayout.setHorizontalSpacing(10);// BorderLayout分五块之间的间距borderLayout.setVerticalSpacing(10);// BorderLayout分五块之间的间距canvas.setLayoutManager(borderLayout);lws.setContents(canvas);// ----------------GridData--left---right-------GridData gridDataLeftRight = new GridData();gridDataLeftRight.horizontalAlignment = SWT.FILL;gridDataLeftRight.verticalAlignment = SWT.FILL;gridDataLeftRight.grabExcessHorizontalSpace = true;gridDataLeftRight.grabExcessVerticalSpace = true;// ----------------left------------Figure canvasLeft = new Figure();canvasLeft.setSize(100, 0);// 有子元素按子元素的大小canvas.add(canvasLeft, BorderLayout.LEFT);canvasLeft.setLayoutManager(new GridLayout());RectangleFigure rectangleFigure = new RectangleFigure();rectangleFigure.setBackgroundColor(ColorConstants.yellow);rectangleFigure.setSize(50, 0);// 没有子元素按父元素的大小canvasLeft.add(rectangleFigure, gridDataLeftRight);// --------------right--------------Figure canvasRight = new Figure();canvasRight.setSize(100, 0);canvas.add(canvasRight, BorderLayout.RIGHT);canvasRight.setLayoutManager(new GridLayout());rectangleFigure = new RectangleFigure();rectangleFigure.setBackgroundColor(ColorConstants.yellow);rectangleFigure.setSize(50, 0);canvasRight.add(rectangleFigure, gridDataLeftRight);// ----------------GridData--top---bottom-------GridData gridDataTopBottom = new GridData();gridDataTopBottom.horizontalAlignment = SWT.FILL;gridDataTopBottom.verticalAlignment = SWT.FILL;gridDataTopBottom.grabExcessHorizontalSpace = true;gridDataTopBottom.grabExcessVerticalSpace = true;gridDataTopBottom.horizontalIndent = 100;// --------------top--------------Figure canvasTop = new Figure();canvasTop.setSize(0, 100);canvas.add(canvasTop, BorderLayout.TOP);canvasTop.setLayoutManager(new GridLayout());rectangleFigure = new RectangleFigure();rectangleFigure.setBackgroundColor(ColorConstants.blue);rectangleFigure.setSize(0, 50);canvasTop.add(rectangleFigure, gridDataTopBottom);// -------------bottom---------------Figure canvasBottom = new Figure();canvasBottom.setSize(0, 100);canvas.add(canvasBottom, BorderLayout.BOTTOM);canvasBottom.setLayoutManager(new GridLayout());rectangleFigure = new RectangleFigure();rectangleFigure.setBackgroundColor(ColorConstants.blue);rectangleFigure.setSize(0, 50);canvasBottom.add(rectangleFigure, gridDataTopBottom);// ------------center----------------Figure canvasCenter = new Figure();// canvasCenter.setSize(0, 0);canvas.add(canvasCenter, BorderLayout.CENTER);canvasCenter.setLayoutManager(new GridLayout());rectangleFigure = new RectangleFigure();rectangleFigure.setBackgroundColor(ColorConstants.red);// rectangleFigure.setSize(50, 40);canvasCenter.add(rectangleFigure, gridDataLeftRight);}@Overrideprotected void checkSubclass() {// Disable the check that prevents subclassing of SWT components}}
。
0 0
- draw2d的布局
- draw2d 布局
- draw2d的布局(加滚动条)
- Draw2d之FlowLayout布局
- Draw2d里的Invalidating和Updating,布局管理器
- Draw2d中的布局管理器Layout比较
- draw2d,toolbar布局让单元格高度相等方法
- Draw2d中如何控制ToolTip的持续时间
- 多边形 UML 类图的draw2d画法
- 一个简单的Draw2d动画实例
- Draw2d 半透明渐变Label的实现
- Draw2D、GEF、GMF和EMF的解释
- Draw2D、GEF、GMF和EMF的解释
- 关于Draw2d图形的导出到图片的函数。
- DirectX学习笔记_关于Sprite.Draw2D的说明
- SWT事件到Draw2d事件转化的代码解读
- DirectX学习笔记_关于Sprite.Draw2D的说明
- DirectX学习笔记_关于Sprite.Draw2D的说明
- [Kafka]_0
- Android学习路线指南
- 将char*转化成CString
- ros下编程
- WSClient客户端调用---apache.cxf
- draw2d的布局
- 06_01 向成绩表中插入数据
- startActivityForResult和setResult详解
- 圆形目标中心点在tof相机坐标系下的三维坐标的计算(2)
- RecyclerView中item内有EditText监听addTextChangedListener出错
- RxJava教程
- android power键流程
- C++类成员初始化
- error LNK2019: 无法解析的外部符号 _gzputs,该符号在函数 "void __cdecl icvPuts(struct CvFileStorage *,char const