Another possible workaround is to call Node#applyCss() before stage.show(). 
There is an example in the Javadoc for the applyCss() method.

-----Original Message-----
From: openjfx-dev <openjfx-dev-boun...@openjdk.java.net> On Behalf Of Dirk 
Lemmermann
Sent: Wednesday, April 22, 2020 1:46 PM
To: OpenJFX <openjfx-dev@openjdk.java.net>
Subject: [EXTERNAL] White box / window flicker upon launch

Hi everyone,

is it just me or did something change in the launch behaviour of JavaFX 
applications? It seems we are back to the old “grey box” bug of Swing where the 
window would appear first before filling its content. I noticed the same (but 
white) effect now for my JavaFX apps, especially when running on mobile devices 
via Gluon. Once I saw it there I paid attention to it and also noticed it when 
running my desktop apps (on MacOS). I must admit that I am also not certain if 
it has been different before. Maybe I simply notice it now?

To verify run this little program. You have to pay close attention but if I am 
not mistaken then the window first shows up with a white background before 
showing its content, which is orange.

Can somebody confirm? If so, I will create a bug ticket.

Regards,

Dirk


import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class BugDemo extends Application {

    public void start(Stage stage) {
        VBox root = new VBox();
        root.setStyle("-fx-background-color: orange;");
        Scene scene = new Scene(root, 1000, 800);
        stage.setScene(scene);
        stage.show();
    }

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

Reply via email to