【发布时间】:2018-12-20 11:02:31
【问题描述】:
我使用 debian 9 gnu linux。当我使用 eclipse 运行应用程序时,出现以下错误: Shell 无法解析为类型 显示无法解析为类型 导入org.eclipse无法解析
我从帮助中安装了 swt> 安装新软件
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class SWTapplication {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
// the layout manager handle the layout
// of the widgets in the container
//shell.setLayout(new FillLayout());
//TODO add some widgets to the Shell
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
【问题讨论】:
-
使用“帮助 > 安装新软件”不会将 SWT 作为依赖项添加到您的项目中。您使用的是 Maven、Gradle 还是其他工具?