Reputation: 15
I have tic-tac-toe game on BorderPane. On the left side I have simple chat. I want set possibility send another message after first after 5 second, i.e. I want set disable for chat for 5 second, but another parts of application must work. How can I do this.
@FXML
private GridPane mainGridPane; //here game
@FXML
private GridPane smileGridPane; //this I want stop for five second
Upvotes: 0
Views: 21
Reputation: 82461
A PauseTransition
with a onFinished
handler reenabling the pane will do the trick:
smileGridPane.setDisable(true); // disable target pane
PauseTransition pause = new PauseTransition(Duration.seconds(5));
pause.setOnFinished(evt -> smileGridPane.setDisable(false)); // reenable target pane
pause.play();
Upvotes: 2