fix truncation of alert content in windows

This commit is contained in:
Craig Raw 2022-03-03 13:14:12 +02:00
parent 81810fced5
commit aebc670b62

View file

@ -734,8 +734,9 @@ public class AppServices {
} }
String[] lines = content.split("\r\n|\r|\n"); String[] lines = content.split("\r\n|\r|\n");
if(lines.length > 3) { if(lines.length > 3 || org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.WINDOWS) {
alert.getDialogPane().setPrefHeight(200 + lines.length * 20); double numLines = Arrays.stream(lines).mapToDouble(line -> Math.ceil(TextUtils.computeTextWidth(Font.getDefault(), line, 0) / 300)).sum();
alert.getDialogPane().setPrefHeight(200 + numLines * 20);
} }
moveToActiveWindowScreen(alert); moveToActiveWindowScreen(alert);