package test;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.stage.Stage;
import javafx.util.Duration;
/**
*
* @author Loli
*/
public class NewClass1 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
int sleep = 1000;
KeyFrame kf = new KeyFrame(Duration.millis(sleep), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("ok");
}
});
Timeline t = new Timeline(kf);
t.setCycleCount(Timeline.INDEFINITE);
t.play();
}
}
留言列表