JAVAFX: Set cursor CURSOR.WAIT while running PauseTransition

时间:2019-04-17 01:27:51

标签: java javafx

How to set the cursor to CURSOR.WAIT while running PauseTransition?

public void dashboard() {
    PauseTransition wait = new PauseTransition(Duration.seconds(1));
    wait.setOnFinished((e) -> {
        GuiManager.getInstance().showView(new DashboardView());
    });
    wait.play();
}

1 个答案:

答案 0 :(得分:1)

使用Picasso代替PauseTransition:

Animation wait = new Timeline(
    new KeyFrame(Duration.ZERO,
        new KeyValue(someNode.cursorProperty(), Cursor.WAIT)),
    new KeyFrame(Duration.seconds(1),
        new KeyValue(someNode.cursorProperty(), null)));

wait.setOnFinished(e -> 
    GuiManager.getInstance().showView(new DashboardView()));

wait.play();