package com.example; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.util.Duration; public class MainController { @FXML void onClickStartButton(ActionEvent event) { KeyFrame kf = new KeyFrame(Duration.seconds(1), e -> { System.out.println("idő van"); }); Timeline tm = new Timeline(); tm.getKeyFrames().add(kf); tm.setCycleCount(Timeline.INDEFINITE); tm.play(); } }