How to create two windows simultaneously in JavaFX?


I tried this one JavaFX 2.0 subwindow but the problem is, there is only one Stage can repaint(refresh), the other one just frozen, if you put some button on that stage, you will find that the button didn't show "over" and "press" picture, how to solve this?

5/23/2017 12:14:17 PM

Did you created new Stage on the "JavaFX Application Thread"?

Try next:

    javafx.application.Platform.runLater(new Runnable() {

        public void run() {
            Stage stage = new Stage();
            stage.setScene(new Scene(new Group(new Button("my second window"))));

All FX UI operations should be executed on "JavaFX Application Thread", see

5/8/2012 6:39:01 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow