阅 读 文 章

SWT&Jface权威指南---SWT中控件的使用

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


/**
 * 作 者 :李天泉
 *工作地:北京中关村软件园   
 */
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.graphics.*;

/**
 * 此类演示Labels控件的使用
 */
public class LabelExample {
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell();
    shell.setLayout(new GridLayout(1, false));

    // 创建一个label控件
    new Label(shell, SWT.NONE).setText("This is a plain label.");

    // 创建一个垂直的分割线
    new Label(shell, SWT.SEPARATOR);

    // 创建一个带有边框的Label控件
    new Label(shell, SWT.BORDER).setText("This is a label with a border.");

    // 创建一个水平的分割线
    Label separator = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // 创建一个带有图片的label控件
     Image image = new Image(display, "heihei.jpg");
    Label imageLabel = new Label(shell, SWT.NONE);
    imageLabel.setImage(image);
    shell.setText("順天科技--勤學博思製作");
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
}








 勤学博思 回复于:2005-03-30 20:21:55

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

/**
 * 此类演示 Buttons控件
 */
public class ButtonExample {
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout(3, true));

    // 创建三个按钮控件
论坛热门帖子: [lch203] 写得蛮好的linux学习笔记(10-21)
[黑马制造] 学习java的30个目标(10-19)
[笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19)
[udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18)
[沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18)
TAG标签: 控件 使用 指南 权威 // shell 创建 newMenuItem menu

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

发表评论

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

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