读书人

Draw2d 学习札记三 FlowLayout

发布时间: 2012-11-06 14:07:00 作者: rapoo

Draw2d 学习笔记三 FlowLayout

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) {IFigure panel = new Panel();panel.setLayoutManager(new FlowLayout());for(int i=0; i<100; i++) {panel.add(new Label("Label " + i));}LightweightSystem lws = new LightweightSystem(shell);lws.setContents(panel);}}

?


Draw2d 学习札记三 FlowLayout
?

FlowLayout布局管理器在swt中也有对应的布局管理器,应用起来也是比较的简单。可以根据外部的窗口大小的变化自动调整内部的布局。

/**
?* Lays out children in rows or columns, wrapping when the current row/column is filled.
?* The aligment and spacing of rows in the parent can be configured.? The aligment and
?* spacing of children within a row can be configured.
?*/

读书人网 >软件架构设计

热点推荐