JavaFX 创建的警告对话框太小

JavaFX creates Alert dialog which is too small

我在 Java 11 in Linux(openSUSE Tumbleweed 20190314 上的 KDE Plasma 5.12.2)上使用 JavaFX 11.0.1 创建一个 Alert对话框应如下所示:

但大多数情况下,当创建并显示 Alert 时,它呈现得太小并且看起来像这样:

大约五分之一的 Alert 会正确显示。但其余时间显示无用的小版本。

用于显示此对话框的代码没有任何异常:

Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Feature absent");
alert.setContentText(
    "Feature \"edit application settings\" has not been finished yet.");
alert.showAndWait();

我还尝试 添加以下内容以尝试将大小强制设置为有用的值:

alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.getDialogPane().setMinWidth(Region.USE_PREF_SIZE);

但这给出了完全相同的行为。 (请注意,即使设置最小宽度和高度的数值仍然不能解决问题。)

这是 JavaFX 11 中的已知错误吗?是否有一些已知的解决方法可以用来确保 Alert 对话框实际上是可读的?

已经有一个已知问题 reported on the exact same problem, affecting Linux with KDE. It can be traced back to this bug,影响 JavaFX 10 和 11。

该问题提供了一个可行的解决方法:

alert.setResizable(true);
alert.onShownProperty().addListener(e -> { 
    Platform.runLater(() -> alert.setResizable(false)); 
});

但这可能会使警报对话框可调整大小。