public class HelloWorldSWT {
public static void main(String[] args) {
// TODO Auto-generated method stub Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Hello world!");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose(); }}
编译后出错,Display can not be resolved to a type
            Shell can not be resolved to a type

解决方案 »

  1.   

    如果是不能编译的话,那就是SWT的jar没有被引用进来。建议你用Eclipse的环境玩swt。
      

  2.   

    找不到类
    程序没有正确引入SWT的jar包
      

  3.   

    多谢您及时回复!
    我是从eclipese网站下载swt-3.5.1-win32-win32-x86.zip,
    然后在myeclipse import等操作后,加入代码。run后就出错了。
    如果导入SWT的jar 请问该如何造作呢?
    多谢!
      

  4.   

    用Eclipse吗? 还是命令行呢?
    命令行的话就把解压zip后的jar包配置到环境变量中
    要是Eclipse的话Build Path引入包即可 
    还有你的问题就是没有引包
      

  5.   

    都玩SWT了,还是用Eclipse IDE吧!显然lz在命令行下弄的
      

  6.   

    LZ没有安装SWT类库吧,去www.eclipse.org上下了后再eclipse配置SWT,在网上搜一下,很多的