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

Alert expandableContent truncated in Linux Mint 18

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.8.0_111"
      Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux Mint 18

      A DESCRIPTION OF THE PROBLEM :
      The ExceptionDialog example from here http://code.makery.ch/blog/javafx-dialogs-official/
      will not show the full expandable content when pressing the show details button. It truncates.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the supplied test code which is based off the ExceptionDialog example here http://code.makery.ch/blog/javafx-dialogs-official/

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The expandable content of the alert should show fully.
      ACTUAL -
      The expandable content is truncated.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.FileNotFoundException;
      import java.io.PrintWriter;
      import java.io.StringWriter;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Alert;
      import javafx.scene.control.Alert.AlertType;
      import javafx.scene.control.Button;
      import javafx.scene.control.Label;
      import javafx.scene.control.TextArea;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.GridPane;
      import javafx.scene.layout.Priority;
      import javafx.stage.Stage;

      public class DialogTest extends Application
      {

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

          @Override
          public void start(
              Stage primaryStage)
          {
              primaryStage.setTitle("DialogTest");

              Button button = new Button("Show Dialog");
              BorderPane panel = new BorderPane();
              panel.setCenter(button);

              button.setOnAction(actionEvent ->
              {
                  showDialog();
              });

              Scene scene = new Scene(panel, 200, 200);
              primaryStage.setScene(scene);
              primaryStage.show();
          }
          
          private void showDialog()
          {
              Alert alert = new Alert(AlertType.ERROR);
              alert.setTitle("Exception Dialog");
              alert.setHeaderText("Look, an Exception Dialog");
              alert.setContentText("Could not find file blabla.txt!");

              Exception ex = new FileNotFoundException("Could not find file blabla.txt");

              // Create expandable Exception.
              StringWriter sw = new StringWriter();
              PrintWriter pw = new PrintWriter(sw);
              ex.printStackTrace(pw);
              String exceptionText = sw.toString();

              Label label = new Label("The exception stacktrace was:");

              TextArea textArea = new TextArea(exceptionText);
              textArea.setEditable(false);
              textArea.setWrapText(true);

              textArea.setMaxWidth(Double.MAX_VALUE);
              textArea.setMaxHeight(Double.MAX_VALUE);
              GridPane.setVgrow(textArea, Priority.ALWAYS);
              GridPane.setHgrow(textArea, Priority.ALWAYS);

              GridPane expContent = new GridPane();
              expContent.setMaxWidth(Double.MAX_VALUE);
              expContent.add(label, 0, 0);
              expContent.add(textArea, 0, 1);

              // Set expandable Exception into the dialog pane.
              alert.getDialogPane().setExpandableContent(expContent);

              alert.showAndWait();
          }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: