DialogPane flickering when embedded in a Scene

Viewed 113

I'm working on a project where DialogPane is used to show dialogs inside the scene rather than as floating windows. In JavaFX 11 there appears to have been a regression where the layout constantly flickers. I've isolated to the following example.

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ButtonType;
import javafx.scene.control.DialogPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

public class DialogPaneIssue extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        DialogPane pane = new DialogPane();
        pane.setContentText(
                "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore");
        pane.getButtonTypes().add(ButtonType.APPLY);
        primaryStage.setScene(new Scene(new HBox(pane)));
        primaryStage.setWidth(300);
        primaryStage.setHeight(200);
        primaryStage.show();
    }

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

The issue appears related to changes in javafx.scene.control.DialogPane.layoutChildren() such as

if (prefHeight > currentHeight && prefHeight > minHeight && (prefHeight <= dialogHeight || dialogHeight == 0)) {
    h = prefHeight;
    resize(w, h);
} else {
    boolean isDialogGrowing = currentHeight > oldHeight;

I'm after any kind of workaround for this, ideally something solid, without reflection.

0 Answers
Related