Javafx-2 – is there any way to hide the stage after a certain time?
•
Java
Is there any way to hide a stage a few seconds or minutes after the specified time?
Solution
Solutions using timeline:
final Stage stage = new Stage();
stage.setScene(new Scene(new Label("Hello")));
stage.show();
Timeline timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(10),new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
stage.hide();
}
}));
timeline.play();
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
