英文:
Problem with Jar file loading in Scene Builder
问题
以下是翻译好的内容:
我在将我的 jar 文件添加到 Scene Builder 库时遇到了问题。当我点击打开时,导入对话框中没有显示任何内容。
private Alert mb;
public FXMLDocumentController() {
FXMLLoader fxmlLoader = new FXMLLoader(
getClass().getResource("/data/Data.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
mb = new Alert(Alert.AlertType.CONFIRMATION);
}
到目前为止,我已经发现,当我注释掉 "mb = new Alert(Alert.AlertType.CONFIRMATION);" 这一行时,问题就消失了,jar 文件加载成功。
这个警告对所有这些产生了什么影响?
JavaFX SDK 11,Java JDK 11,Scene Builder 11
英文:
I have a problem with adding my jar file to the Scene Builder Library. When I click open, nothing shows in the import dialog.
private Alert mb;
public FXMLDocumentController() {
FXMLLoader fxmlLoader = new FXMLLoader(
getClass().getResource("/data/Data.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
mb = new Alert(Alert.AlertType.CONFIRMATION);
}
What I have found out so far is that when I comment "mb = new Alert(Alert.AlertType.CONFIRMATION);" the problem disappears and the jar loads.
How is the alert affecting all this?
Javafx sdk 11, Java jdk 11, Scene Builder 11
答案1
得分: 0
你尝试过在 fmxlLoader.load()
前面添加警告并查看是否有效吗?
英文:
Have you tried to add the alert before fmxlLoader.load()
and see if that works
专注分享java语言的经验与见解,让所有开发者获益!
评论