阅 读 文 章

SWT&Jface权威指南---SWT中布局管理器

[来源:网上转载 (http://www.chinaunix.net) | 作者:网友(勤学博思) | 时间:2007-05-27 | 浏览:人次 ]


/**
 *大家一起来学习
 *本例由于和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 // 博思

最新评论 共有0位网友发表了评论

发表评论

评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名:(注册)
密码:
验证码:
匿名发表

网站地图友情连接交流论坛网站投稿广告服务联系我们留言本站长统计
Some rights reserved: www.chmhome.com, 鄂ICP备07010232号 E-mail:chinakafei@live.com,QQ:552766
中国咖啡技术网(Chmhome):国外编程技术书籍,中文编程手册,经典编程文章,交流技术,技术软件下载,计算机论文,毕业论文.