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

Dialog's preferred size no longer accommodates multi-line strings

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u202, openjfx13
    • Fix Version/s: openjfx14
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux

      Backports

        Description

        ADDITIONAL SYSTEM INFORMATION :
        $ uname -a
        Linux orion 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2 (2019-08-28) x86_64 GNU/Linux

        $ java -version
        openjdk version "13" 2019-09-17
        OpenJDK Runtime Environment AdoptOpenJDK (build 13+33)
        Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.16.0, JRE 13 Linux amd64-64-Bit Compressed References 20190916_75 (JIT enabled, AOT enabled)
        OpenJ9 - 867dab457
        OMR - d4c85c31
        JCL - 2858e3f001 based on jdk-13+33)


        A DESCRIPTION OF THE PROBLEM :
        As of JavaFX 13, a Dialog is only tall enough to display a single line of content text. If the content text contains one or more newline characters, the content area is still tall enough to accommodate only the first line of text, followed by an ellipsis.

        In JavaFX 12, Dialogs properly accommodated multi-line text.


        REGRESSION : Last worked in version 12.0.2

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Create a Dialog, and call its setContentText method with an argument that contains at least one newline character. Then show the Dialog.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The Dialog should be tall enough to show all lines of the content text. In JavaFX 12, this was the case.
        ACTUAL -
        In JavaFX 13, the Dialog only shows the first line of content text, followed by an ellipsis.

        ---------- BEGIN SOURCE ----------
        import javafx.application.Application;

        import javafx.stage.Stage;

        import javafx.scene.Scene;

        import javafx.scene.control.ButtonType;
        import javafx.scene.control.Dialog;

        import javafx.scene.layout.BorderPane;

        public class MultilineDialogTest
        extends Application {
            @Override
            public void start(Stage stage) {
                Scene scene = new Scene(new BorderPane(), 500, 500);
                stage.setScene(scene);
                stage.setTitle("Multi-line Dialog Test");
                stage.show();

                Dialog<ButtonType> dialog = new Dialog<>();
                dialog.initOwner(stage);
                dialog.setTitle("Multi-line Dialog");
                dialog.setContentText("This\nis\na\ntest");
                dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
                dialog.showAndWait();

                stage.hide();
            }

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

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

        CUSTOMER SUBMITTED WORKAROUND :
        Obtain the parent Window from the DialogPane's Scene, and size it manually.

        FREQUENCY : always


          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  tsayao Thiago Sayao
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: