ADDITIONAL SYSTEM INFORMATION :
Windows 10 / x64 / jdk 14.0.1
A DESCRIPTION OF THE PROBLEM :
Wrong calculation of height for Alert dialog/DialogPane when using multiline text and HiDPI scaling set to 125%, 150%, ... on Windows OS.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
set HiDPI scaling to 125% and run attached program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Full text of contentLabel ("Lorem ipsum ...") must be displayed on multiple lines.
ACTUAL -
contentLabel is truncated and first text line is shown only.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class testAlert extends Application
{
private final String TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
public static void main(String[] args)
{
launch(args);
}
@Override
public void start(Stage primaryStage)
{
primaryStage.setTitle("Test Alert");
Button btn = new Button();
btn.setText("Show Alert");
btn.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent event)
{
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Warning Dialog");
alert.setHeaderText("Look, a Warning Dialog");
alert.setContentText(TEXT);
alert.show();
}
});
StackPane root = new StackPane();
root.getChildren().add(btn);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}
}
---------- END SOURCE ----------
FREQUENCY : always