Pavel_Kisliuk
Pavel_Kisliuk

Reputation: 15

Set disable some pane for specify time

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

Answers (1)

fabian
fabian

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

Related Questions