JavaFX Alert会截断邮件吗?

我注意到,如果我尝试用长消息显示Alert ,它往往会被截断(在单词边界)。

例:

 import javafx.application.Application; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.stage.Stage; public class AlertTest extends Application { @Override public void start(final Stage primaryStage) throws Exception { new Alert(AlertType.INFORMATION, "this is a pretty long message that " + "should not be truncated in this alert window, no matter " + "how long it is").showAndWait(); } public static void main(final String... args) { launch(args); } } 

这只显示“这是一个不应该被截断的非常长的消息”。
截断的原因是什么,我该如何避免呢?

我在Linux中使用Oracle JDK 1.8.0_60。

我认为这只是一个Windows和Linux问题。 它不会发生在MacOS上。 但是我认为这将在所有平台上为您解决。

 Alert alert = new Alert(AlertType.INFORMATION); alert.setContentText("this is a pretty long message that " + "should not be truncated in this alert window, no matter " + "how long it is"); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.showAndWait(); 

试试吧

 Alert alert = new Alert(AlertType.INFORMATION); alert.getDialogPane().setContent( new Text("this is a pretty long message that " + "should not be truncated in this alert window, no matter " + "how long it is")); alert.showAndWait();