How to close a stage after a certain amount of time JavaFX

前端 未结 3 1763
时光取名叫无心
时光取名叫无心 2021-01-04 14:04

I\'m currently working with two controller classes.

In Controller1 it creates a new stage that opens on top of the main one.

Stage stage = new Stage         


        
3条回答
  •  萌比男神i
    2021-01-04 14:21

    Use a PauseTransition:

    PauseTransition delay = new PauseTransition(Duration.seconds(5));
    delay.setOnFinished( event -> stage.close() );
    delay.play();
    

提交回复
热议问题