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 prevent FxStage configuration being visible to the user? #3

Open
SKeeneCode opened this issue Feb 15, 2021 · 1 comment
Open

Comments

@SKeeneCode
Copy link

At the moment it seems wherever I configure my stage object in my start method, there is a lag after the stage being shown to when it is modified. Given the example:

public class Demo extends Application {

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

    @Override
    public void start(Stage primaryStage)
    {
        VBox box = new VBox();

        Scene scene = new Scene(box, 350, 200);
        primaryStage.setScene(scene);
        primaryStage.setTitle("Indent Demo");
        FxStage.configure(primaryStage).apply();
        primaryStage.show();
    }
}

Or even just

    public void start(Stage primaryStage)
    {
        VBox box = new VBox();
        FxStage.create(box).apply().getStage().show();
    }

There is a short period of time where the stage is displayed in its vanilla javafx look before it changes.

Is there a way to prevent this? Perhaps hiding the visibility of the stage until the configuration has been made and then showing it?

@micheljung
Copy link
Owner

micheljung commented Mar 1, 2021

Unfortunately, show() needs to be called in order to create the Window. Only then I can access the window handle and modify it. There might be a way to create the window handle before calling show() but IIRC I tried this and debugged deep into JavaFX's source code and it seemed impossible.

I'm not sure if I tried hiding the stage but I don't think one can hide a stage that hasn't been shown :-) I think as soon as you call show() you'll get the flicker, no matter what you do. But feel free to prove me wrong :D

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