问题描述
我将 JavaFX 旧版 UI 代码重构为 FXML。当我从 Eclipse 启动我的 RCP 4 应用程序时,一切正常,并且 FXML 已加载,但是当我部署我的应用程序时,我收到一个异常,无法加载与下面显示的包名称相关的 .fxml 文件。>
要加载 FXMLi,请使用以下 FXML 加载器,正如我在 Eclipse 中所说的那样:
InjectingFXMLLoader<Parent> iFXMLLoader = InjectingFXMLLoader.create(context,Platform.getBundle(bundleName),relativeLocation);
我导出了所有文件,现在我不知道该怎么办了-.- 谁能帮帮我?
更新:我现在可以加载 FXML 并且它在 Eclipse 中运行良好。我使用下面的代码:
FXCanvas canvas = new FXCanvas(parent,SWT.None);
InjectingFXMLLoader<Parent> iFXMLLoader = InjectingFXMLLoader.create(context,Platform.getBundle(StringTable.BUNDLE_NAME),"/ProjectExplorerView.fxml");
InjectingFXMLLoader.Data<Parent,Object> fxmlData;
try {
fxmlData = iFXMLLoader.loadWithController();
Scene scene = new Scene((borderpane) fxmlData.getNode());
canvas.setScene(scene);
((ProjectExplorerViewController) fxmlData.getController()).initializeView(context,fileSystem,canvas);
} catch (IOException e) {
e.printstacktrace();
}
现在再次在部署的 RCP 应用程序中,我得到一个新的异常,如下所示:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)