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

[Dialogs] Text cut off in Dialogs API when wrapped over multiple lines

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u40
    • Fix Version/s: 8u40
    • Component/s: javafx
    • Labels:
      None

      Description

      From openjfx-dev email:

      I've just tried the upcoming (u40) new Dialogs API (good job, BTW, looks/feels great) and noticed that long content texts will be cut off (elipsis).

      Here's an example:

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Alert;
      import javafx.scene.control.Alert.AlertType;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.control.MenuItem;
      import javafx.scene.input.KeyCombination;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class DialogCutOffBug extends Application {

          public DialogCutOffBug() {
          }

          @Override
          public void start(Stage stage) throws Exception {
              stage.setTitle("Menu Sample");
              Scene scene = new Scene(new VBox(), 400, 350);

              MenuBar menuBar = new MenuBar();

              // --- Menu File
              Menu menuFile = new Menu("File");
              menuBar.getMenus().addAll(menuFile);

              MenuItem test = new MenuItem("Open Dialog");
      test.setAccelerator(KeyCombination.keyCombination("Ctrl+O"));
              test.setOnAction(new EventHandler<ActionEvent>() {
                  public void handle(ActionEvent t) {
                      Alert alert = new Alert(AlertType.INFORMATION);
                      alert.setTitle("Information Dialog");
                      alert.setHeaderText("Short");
                      alert.setContentText("Whenever I start to use dialogs, there is certain verboseness involved, which will make the dialog basically useless, however JavaFX should not produce ellipses here, because the Dialog text should always be displayed in Full");
                      alert.showAndWait();
                  }
              });

              menuFile.getItems().add(test);

              ((VBox) scene.getRoot()).getChildren().addAll(menuBar);

              stage.setScene(scene);
              stage.show();
          }

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

        Attachments

          Activity

            People

            Assignee:
            jgiles Jonathan Giles
            Reporter:
            jgiles Jonathan Giles
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: