Dialog contentText does not wrap correctly always
Daniel Peintner
daniel.peintner at gmail.com
Tue Mar 23 08:28:24 UTC 2021
Hello,
Sorry for bothering you with my first email providing an example that used
a helper class for showing the dialog.
I looked further and please find below or in [1] a Short, Self Contained,
Correct (Compilable), Example.
The issue appears for cases when setting "glass.win.uiScale" to "1.5".
The need for a second line for the alert contentText seems to fail and
ellipses appear.
Setting dialog.getDialogPane().setExpanded(true); makes the line appear but
the dialog buttons move out of scene.
On [1] you can also see some screenshots that illustrate the issue.
Do you consider this as a bug? Does it make sense to open a bug report (I
don't have the privileges to do so)?
I hope I can help to make JavaFX even better.
Note: I am using Windows 10, JavaFX version 16.
Thanks again,
-- Daniel
[1] https://github.com/danielpeintner/Java11Test/issues/5
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();
}
}
On Thu, Mar 18, 2021 at 12:07 PM Daniel Peintner <daniel.peintner at gmail.com>
wrote:
> 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