1@FXML
2public void initialize() {
3
4 Timeline clock = new Timeline(new KeyFrame(Duration.ZERO, e -> {
5 LocalTime currentTime = LocalTime.now();
6 time.setText(currentTime.getHour() + ":" + currentTime.getMinute() + ":" + currentTime.getSecond());
7 }),
8 new KeyFrame(Duration.seconds(1))
9 );
10 clock.setCycleCount(Animation.INDEFINITE);
11 clock.play();
12}
13