/**
* 作 者 :李天泉
*工作地:北京中关村软件园
*/
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 |
注册
个人空间
