首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Draw2d 学习札记三 FlowLayout

2012-11-06 
Draw2d 学习笔记三 FlowLayoutpublic class HelloWorld {public static void main(String args[]) {Shell

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.
?*/

热点排行