Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8115148

Timeline doesn't work with some durations in Java7u21 (works in Java8b92)

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 7u21
    • 8
    • javafx
    • None
    • jdk7u21, os x 10.8

    Description

      For certain durations, key frame event handlers are not executed.
      In the program below the key frame event handler is not executed for Duration.millis(1000 / 30.1)
      If the duration is changed to Duration.millis(1000 / 30.0), then the keyframe event handler is executed.

      This bug report is from a stack overflow question:
      http://stackoverflow.com/questions/17004022/timeline-doesnt-work-with-some-durations

      import javafx.animation.*;
      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.util.Duration;
      import javafx.stage.Stage;

      public class Ticker extends Application {
          private Timeline videoTick;

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(final Stage primaryStage) {
              Duration duration = Duration.millis(1000 / 30.1);
              videoTick = new Timeline(new KeyFrame(duration, new EventHandler<ActionEvent>() {
                  public void handle(ActionEvent actionEvent) {
                      System.out.println("Tick");
                  }
              }));
              videoTick.setCycleCount(Animation.INDEFINITE);
              videoTick.playFromStart();
          }
      }

      Attachments

        Activity

          People

            msladecek Martin Sládeček
            josmithjfx John Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: