【发布时间】:2013-06-04 13:54:09
【问题描述】:
我想在 JavaFX 应用程序中禁用特定时间的按钮。有什么选择吗?如果没有,是否有任何解决方法?
以下是我在应用程序中的代码。我试过Thread.sleep,但我知道这不是阻止用户点击下一步按钮的好方法。
nextButton.setDisable(true);
final Timeline animation = new Timeline(
new KeyFrame(Duration.seconds(delayTime),
new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
nextButton.setDisable(false);
}
}));
animation.setCycleCount(1);
animation.play();
【问题讨论】:
标签: javafx-2