標準部件工具箱(,縮寫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();
}
}
參見
*
*
参考资料
*
*
*
*
*
*
外部連結
- [http://www.eclipse.org/swt/ SWT main page]
- [news://news.eclipse.org/eclipse.platform.swt SWT newsgroup](這個新聞群組被密碼所保護;密碼申請由[https://web.archive.org/web/20060831190951/http://dev.eclipse.org/newsManager/newsRequestForm.html 這])
- [https://web.archive.org/web/20080516051507/http://www.oneclipse.com/Members/admin/news/swt-sightings Eclipse applications]
- [https://web.archive.org/web/20080516051738/http://www.oneclipse.com/Members/admin/news/swt-sightings-vol-2 Eclipse applications, part 2]
- [https://web.archive.org/web/20080505084239/http://wiki.eclipse.org/index.php/FAQ_Where_can_I_find_more_information_on_SWT Further information on SWT]
- [https://web.archive.org/web/20060421021028/http://www.eclipse.org/documentation/main.html Information on Eclipse],including SWT information within a "platform plug-in developer guide"
- [http://help.eclipse.org/help31/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/package-summary.html SWT Javadoc API] documented at eclipse.org
评论 (0)