SWT学习笔记(3)——第一个程序

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

这个程序用VE插件自动生成,VE的信息见http://blog.csdn.net/happy1123/archive/2004/10/10/130395.aspx

源码:

import org.eclipse.swt.graphics.Point;

import org.eclipse.swt.widgets.Display;

import org.eclipse.swt.widgets.Shell;

public class SwtAppTest {

private Shell sShell = null;

public static void main(String[] args) {

/* Before this is run, be sure to set up the following in the launch configuration

* (Arguments->VM Arguments) for the correct SWT library path.

* The following is a windows example:

* -Djava.library.path="installation_directory\plugins\org.eclipse.swt.win32_3.0.0\os\win32\x86"

*/

Display display = Display.getDefault();

SwtAppTest thisClass = new SwtAppTest();

thisClass.createSShell() ;

thisClass.sShell.open();

while (!thisClass.sShell.isDisposed()) {

if (!display.readAndDispatch()) display.sleep ();

}

display.dispose();

}

/**

* This method initializes sShell

*/

private void createSShell() {

sShell = new Shell();

sShell.setSize(new Point(300,200));

sShell.setText("Shell");

}

}

这是一个空白窗口,如下图:

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航