標準部件工具箱

標準部件工具箱(,縮寫SWT)是最初由IBM开发的一套用于Java的图形用户界面系统,用来与Swing竞争。

开源整合開發環境Eclipse就是用Java和SWT开发的。

設計
編程
環境下使用SWT的簡單GUI應用程式]]

下列為基本使用SWT的Hello World程式。顯示出一個視窗(Shell)及一個標籤。

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

public class HelloWorld
{
public static void main (String[] args)
{
Display display = new Display();
Shell shell = new Shell(display);
Label label = new Label(shell, SWT.NONE);
label.setText("Hello World");
label.pack();
shell.pack();
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}

參見
*
*

参考资料
*
*
*
*
*
*

外部連結

评论 (0)

  • 还没有评论,来抢沙发吧。