【问题标题】:Controlsfx Notifications don't work in compiled jarControlsfx 通知在编译的 jar 中不起作用
【发布时间】:2018-02-17 16:13:36
【问题描述】:

我正在使用 javafx 开发一些带有 GUI 的应用程序,但遇到了一个问题。 当我从 ItelliJ IDEA 运行 Main 类时,来自 controlsfx 库 (org.controlsfx.control.Notifications) 的通知运行良好,但在编译的 jar 中不起作用(我使用“构建工件”编译了 jar)。其他功能也可以。 这是 Controll 类中应该打开弹出窗口的方法

public void zAxisMouseEntered(MouseEvent mouseEvent) {
    Notifications notif1 = Notifications.create();
    notif1.title("Warning message");
    notif1.text("This configuration is slower than 'SPL on Z axis'");
    notif1.hideAfter(Duration.seconds(3));
    notif1.position(Pos.CENTER);
    notif1.showWarning();
}

有人可以在我运行 jar 时帮助我使用此通知吗? 谢谢!

【问题讨论】:

  • 只是一个猜测,但您是否尝试将ControlsFX jar 添加到与您尝试运行的 jar 相同的文件夹中?或者尝试将它放在与您尝试运行的 jar 相同的文件夹中的资源文件夹中。
  • 是的,我已经尝试将 ControlsFX jar 放在它可以放置的每个地方。我使用至少 5 个带有库的外部 jar 文件,它们都运行良好。我只有 ControlsFX 有问题。所有外部库都在一个文件夹中,所以我不明白 ControlsFX 有什么问题...

标签: java javafx popup controlsfx


【解决方案1】:

我已通过将信息打印到控制台来解决此问题。问题是最终 jar 存档中没有两个需要的文件夹(我认为这是 IDEA 错误),所以我手动放入了它们。之后我有 javafx 异常,我添加了这段代码

    notif1.owner(chart3);

之前

    notif1.showWarning();

避免它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-03-19
    • 2018-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-17
    • 1970-01-01
    相关资源
    最近更新 更多