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

Dialog contentText does not wrap correctly always

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      It works in JavaFX 8. I did not try other JavaFX releases such as 9-15.

      A DESCRIPTION OF THE PROBLEM :
      It relates to dialogs where the contentText usually nicely wraps to the next line if it does not fit.

      The issue appears for cases when setting "glass.win.uiScale" to "1.5". (maybe other scales also)

      REGRESSION : Last worked in version 11

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Open JavaFX dialog with longer contentText string.
      Set scale to 1.5
      System.setProperty("glass.win.uiScale", "1.5");

      # Code to reproduce

      see provided code



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      See https://github.com/danielpeintner/Java11Test/issues/5

      There you can find two images. The first one shows the expected result (contentText nicely wrapped).
      ACTUAL -
      See https://github.com/danielpeintner/Java11Test/issues/5

      There you can find two images. The second one shows the failures (contentText *not* nicely wrapped).

      ---------- BEGIN SOURCE ----------

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Alert;
      import javafx.scene.control.Button;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;

      public class TestDialog extends Application {
          public static void main(String[] args) {
              System.setProperty("glass.win.uiScale", "1.5");
              launch(args);
          }

          @Override
          public void start(Stage primaryStage) {
              primaryStage.setTitle("DialogTest!");
              Button btn = new Button();
              btn.setText("Show Dialog");
              btn.setOnAction(event -> {
                  Alert dialog = new Alert(Alert.AlertType.CONFIRMATION);
                  dialog.setTitle("MyTitle");
                  dialog.setHeaderText("MyHeader");
                  dialog.setContentText("myContent 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30");
                  // dialog.getDialogPane().setExpanded(true); // makes the 2nd text line appear but moves the buttons out of the scene
                  dialog.showAndWait();
              });
              BorderPane bp = new BorderPane();
              bp.setCenter(btn);
              primaryStage.setScene(new Scene(bp, 300, 250));
              primaryStage.show();
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Setting dialog.getDialogPane().setExpanded(true); makes the line appear but the dialog buttons move out of scene.

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            kcr Kevin Rushforth
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: