跳转到内容

标准部件工具箱

维基百科,自由的百科全书
标准部件工具箱
截图
Eclipse的IDE环境是以SWT为基础之应用
开发者Eclipse基金会
当前版本3.7.2(2012年2月24日 (2012-02-24)
源代码库 编辑维基数据链接
操作系统跨平台
语言多语言
类型Java平台部件工具箱
许可协议Eclipse公共授权
网站www.eclipse.org/swt/

标准部件工具箱(英语:Standard Widget Toolkit,缩写SWT)是最初由IBM开发的一套用于Java图形用户界面系统,用来与Swing竞争。

开源集成开发环境Eclipse就是用Java和SWT开发的。

设计

[编辑]

编程

[编辑]
GTK+环境下使用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();
   }
}

参见

[编辑]

参考资料

[编辑]
  • Northover, Steve; Wilson, Mike. SWT: The Standard Widget Toolkit, Volume 1. Addison-Wesley. July 8, 2004: 592 [2012-07-10]. ISBN 0-321-25663-8. (原始内容存档于2008-12-22). 
  • Warner, Rob; Harris, Robert L. The definitive guide to SWT and JFace. Apress. June 21, 2004: 684 [2012年7月10日]. ISBN 1-59059-325-1. (原始内容存档于2010年12月5日). 
  • Clayberg, Eric; Rubel, Dan. Eclipse: Building commercial-quality plug-in 2nd. Addison-Wesley Professional. April 1, 2006: 864 [2012-07-10]. ISBN 0-321-42672-X. (原始内容存档于2012-01-14). 
  • Gamma, Erich; Beck, Kent. Contributing to Eclipse. Addison-Wesley. October 30, 2003: 416 [2012-07-10]. ISBN 0-321-20575-8. (原始内容存档于2008-12-22). 
  • D'Anjou, Jim; Fairbrother, Scott; Kehn, Dan; McCarthy, Pat; Kellerman, John. The Java Developers Guide to Eclipse 2nd. Addison-Wesley. November 5, 2004: 1136 [2012-07-10]. ISBN 0-321-30502-7. (原始内容存档于2012-04-19). 
  • Matthew Scarpino, Stephen Holder, Stanford Ng and Laurent Mihalkovic. SWT/JFace in Action. Manning. November 28, 2004: 496. ISBN 1-932394-27-3. 

外部链接

[编辑]