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

[Dialog] Alert dialogs do not resize correctly and cut message

XMLWordPrintable

      On Linux with the Oracle JDK 8u40, Alerts do not correctly resize and long messages will be cut at the end. On Windows, the height of the Alert will be increased such that the message can be displayed correctly.

      Screenshots: see https://stackoverflow.com/questions/28937392/javafx-alerts-and-their-size/28938151

      Code example:
      ----------------
      import javafx.application.Application;
      import javafx.scene.control.Alert;
      import javafx.scene.control.Alert.AlertType;
      import javafx.stage.Stage;


      public class TestAlert extends Application {
          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              Alert a = new Alert(AlertType.INFORMATION);
              a.setTitle("My Title");
              a.setHeaderText("My Header Text");
              a.setResizable(true);
              String version = System.getProperty("java.version");
              String content = String.format("Java: %s.\nThis is a long text. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.", version);
              a.setContentText(content);
              a.showAndWait();
          }
      }

            Unassigned Unassigned
            duke J. Duke
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Imported: