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();
    }
}




arrow
arrow
    全站熱搜

    黃彥霖 發表在 痞客邦 留言(0) 人氣()