Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make ModalPane work? #113

Open
PavelTurk opened this issue Nov 9, 2024 · 1 comment
Open

How to make ModalPane work? #113

PavelTurk opened this issue Nov 9, 2024 · 1 comment

Comments

@PavelTurk
Copy link

I am trying to show a modal box in a modal pane. This is my code:

public class AtlantaFxTest extends Application {

    @Override
    public void start(Stage stage) {
        Application.setUserAgentStylesheet(new PrimerDark().getUserAgentStylesheet());
        var modalPane = new ModalPane();
        var box = new ModalBox(new TextArea("Fffffffffffffffffffffffffff"));
        modalPane.show(box);
        var root = new StackPane(modalPane);
        Scene scene = new Scene(root, 600, 400);
        stage.setScene(scene);
        stage.show();
    }

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

Could anyone say how to do it?

@DeYuanGeGe
Copy link

DeYuanGeGe commented Dec 25, 2024

modalPane须在stage.show()之后调用modalPane.show(node),修改如下:

public void start(Stage stage) {
        Application.setUserAgentStylesheet(new PrimerDark().getUserAgentStylesheet());
        var modalPane = new ModalPane();
        var root = new StackPane(modalPane);
        var box = new ModalBox(new TextArea("Fffffffffffffffffffffffffff"));
        Scene scene = new Scene(root, 600, 400);
        stage.setScene(scene);
        stage.show();
        modalPane.show(box);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants