Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8199592

Control labels truncated at certain DPI scaling levels

    XMLWordPrintable

Details

    • b114
    • 9
    • generic
    • windows

    Backports

      Description

        FULL PRODUCT VERSION :
        java version "9.0.4"
        Java(TM) SE Runtime Environment (build 9.0.4+11)
        Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Windows 10.0.16299.248

        A DESCRIPTION OF THE PROBLEM :
        In a simple self-sizing scene, some or all control labels are incorrectly truncated with an ellipsis at DPI levels between 100% and 200%. On 125% and 150%, this appears to be fixed by an explicit call to sizeToScene which however should not be necessary, and was not necessary in Java SE 8u60. On 175%, which is also one of the standard Windows 10 scaling levels, the bug persists regardless of calling sizeToScene.

        The bug did not appear in several real applications I checked. It seems that increased layout complexity eventually suppresses the bug. There may be an initial text measuring error that eventually gets corrected by additional layout passes.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Compile below test case and run using -Dglass.win.uiScale=125%, 150%, or 175%. Add parameter "sizeToScene" for calling that method explicitly.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        All control labels should always be fully displayed, as the scene is entirely self-sizing without external constraints.
        ACTUAL -
        On DPI levels of 125%, 150%, or 175% some or all control labels are truncated with an ellipsis. Explicitly calling sizeToScene fixes this for 125% and 150% but not for 175% where all control labels are still truncated.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import javafx.application.*;
        import javafx.geometry.*;
        import javafx.scene.*;
        import javafx.scene.control.*;
        import javafx.scene.layout.*;
        import javafx.stage.*;

        public class ControlLabelTest extends Application {

            public static void main(String[] args) {
                Application.launch(args);
            }

            @Override
            public void start(Stage stage) {
                final HBox box = new HBox();
                box.setAlignment(Pos.CENTER);
                box.setPadding(new Insets(8));
                box.setSpacing(8);

                for (int i = 0; i < 4; i++)
                    box.getChildren().add(new CheckBox("Check"));
                stage.setScene(new Scene(box));
               
                if (getParameters().getUnnamed().contains("sizeToScene"))
                    stage.sizeToScene();

                stage.show();
            }
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Explicitly calling sizeToScene appears to suppress the bug at DPI levels other than 175%. Otherwise, only an explicit minimum size for the labeled control works reliably.

        Attachments

          Issue Links

            Activity

              People

                jpereda Jose Pereda
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: