/**
*大家一起来学习
*本例由于和AWT Swing类似,所以没有多作解释,如友疑问,请回帖
*作者:李天泉
*/
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.SWT;
public class FillLayoutHorizontal {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout(SWT.HORIZONTAL));//设置排列方式
new Button(shell, SWT.PUSH).setText("按鈕一");//在shell上新建三个按钮
new Button(shell, SWT.PUSH).setText("按鈕二");
new Button(shell, SWT.PUSH).setText("按鈕三");
shell.setText("順天科技--勤學博思製作");//设置窗口标题
shell.open();//使窗口可见
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {//监听事件
display.sleep();
}
}
display.dispose();//释放资源
}
}
勤学博思 回复于:2005-03-30 19:39:25
运行的图片

勤学博思 回复于:2005-03-30 19:43:20
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.SWT;
public class RowLayoutHorizontal {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new RowLayout(SWT.HORIZONTAL));
new Button(shell, SWT.PUSH).setText("one");
new Button(shell, SWT.PUSH).setText("two");
new Button(shell, SWT.PUSH).setText("three");
new Button(shell, SWT.PUSH).setText("four");
new Button(shell, SWT.PUSH).setText("five");
new Button(shell, SWT.PUSH).setText("six");
new Button(shell, SWT.PUSH).setText("seven");
shell.setText("RowLayoutHorizontal 的練習--順天科技製作");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
| 论坛热门帖子: | [lch203] 写得蛮好的linux学习笔记(10-21) [黑马制造] 学习java的30个目标(10-19) [笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19) [udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18) [沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18) |
| TAG标签: | 布局 管理 指南 权威 shell newButton SWT.PUSH // 博思 |
注册
个人空间
