private void handleButtonAction(ActionEvent event) { Timeline animation = new Timeline(); KeyFrame kf = new KeyFrame(Duration.millis(18), new EventHandler () { public void handle(ActionEvent e) { spin(); } }); payout(); animation.setCycleCount(30); animation.getKeyFrames().add(kf); animation.play(); }