Dialog contentText does not wrap correctly always

Daniel Peintner daniel.peintner at gmail.com
Thu Mar 18 11:07:56 UTC 2021


Hello,

Thank you all for your work. I believe JavaFX is getting better and better.
Some recent updates like [1] fixed some issues I was having with certain
scaling levels.

Today I stumbled over one issue that still exists with JavaFX version 16.
It relates to dialog where the contentText usually nicels wraps to the next
line if it does not fit.

See below a simple code snippet and find on [2] screenshots that show the
problem.
(the problem is that it shows "..." and does *not* wrap to the next line)

Are you aware of that problem?

Thanks,

-- Daniel

[1] https://github.com/openjdk/jfx/pull/351
[2] https://github.com/danielpeintner/Java11Test/issues/5



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

import java.util.Optional;

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

    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("HelloTest!");
        Button btn = new Button();
        btn.setText("Show Dialog");
        btn.setOnAction(event -> {
            System.out.println("Hello World!");
            Optional<ButtonType> result = DialogUtil.showYesNoCancelDialog(
                    "MyTitle", "MyHeader",
                    "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");
        });

        BorderPane bp = new BorderPane();
        bp.setCenter(btn);
        primaryStage.setScene(new Scene(bp, 300, 250));
        primaryStage.show();
    }
}


More information about the openjfx-dev mailing list