JavaFX periodic background task

后端 未结 5 936
时光说笑
时光说笑 2020-11-21 04:43

I try to run in JavaFX application background thread periodically, which modifies some GUI property.

I think I know how to use Task and Service

5条回答
  •  逝去的感伤
    2020-11-21 05:13

    I would Prefer the PauseTransition:

    PauseTransition wait = new PauseTransition(Duration.seconds(5));
    wait.setOnFinished((e) -> {
        /*YOUR METHOD*/
        wait.playFromStart();
    });
    wait.play();
    

提交回复
热议问题