Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Sedrick Jefferson
Added: Apr 25, 2018 3:16 PM
Views: 20
Timeline JavaFX
  1. Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), (actionEvent) -> {
  2.     System.out.println("Hello world!");      
  3. }));
  4.  
  5. timeline.setCycleCount(Timeline.INDEFINITE);
  6. timeline.setOnFinished(actionEvent -> {//This will not run due to Timeline.INDEFINITE above. Change that to 5
  7.     System.out.println("Done");
  8. });
  9. timeline.play();