当我将以下Java代码输入到eclipse中时,它会返回一个错误。日食教程告诉我,这应该起作用。我究竟做错了什么? This is a picture of my code。Eclipse中的SWT Java JDE不工作
import org.eclipse.swt;
public class SWTHELLOWORLD{
public static void main(String[] args){
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();
}
}
当我作为一个Java应用程序运行时,它会返回该错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Display cannot be resolved to a type
Display cannot be resolved to a type
Shell cannot be resolved to a type
Shell cannot be resolved to a type
我正在运行windows 10. –
请不要将文本作为图像发布。将您的代码和错误消息粘贴到您的问题中(并将其格式化以使其可读)。针对你的问题:这个类被称为'String'而不是'Strings'。此外,它看起来像你根本没有进口。 –
您确实需要阅读Java基础知识。错误信息也很清楚。你缺少进口。 – Baz