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
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
程序没有正确引入SWT的jar包
我是从eclipese网站下载swt-3.5.1-win32-win32-x86.zip,
然后在myeclipse import等操作后,加入代码。run后就出错了。
如果导入SWT的jar 请问该如何造作呢?
多谢!
命令行的话就把解压zip后的jar包配置到环境变量中
要是Eclipse的话Build Path引入包即可
还有你的问题就是没有引包