JDK-8252687 : contentText truncated in Alert/DialogPane when HiDPI scaling 125% on Windows
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: jfx14
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2020-09-01
  • Updated: 2024-06-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx24Unresolved
Related Reports
Relates :  
Description
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



Comments
Relates to JDK-8211294
02-09-2020