在Scene Builder中加载Jar文件时出现问题。

huangapple 未分类评论52阅读模式
英文:

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 文件加载成功。

这个警告对所有这些产生了什么影响?

在Scene Builder中加载Jar文件时出现问题。

在Scene Builder中加载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?

在Scene Builder中加载Jar文件时出现问题。

在Scene Builder中加载Jar文件时出现问题。

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

huangapple
  • 本文由 发表于 2020年5月5日 16:44:13
  • 转载请务必保留本文链接:https://java.coder-hub.com/61609163.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定