Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Is it just my computer or is JavaFX a bit jerky?

boomahMay 27 2011 — edited Jun 6 2011
Since I've been using Java I've always had the problem that whenever I try to make something move, it is a bit jerky. I was hoping that JavaFX would solve this problem but with the following code:
package test;

import javafx.animation.Interpolator;
import javafx.animation.TranslateTransition;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
import javafx.util.Duration;

public class SmoothMovementTest extends Application {
    @Override
    public void start(Stage stage) throws Exception {
        Group root = new Group();
        Scene scene = new Scene(root, 800, 400, Color.WHITE);
        stage.setScene(scene);

        Circle circle = new Circle(50.0, Color.RED);
        circle.setCenterX(50.0);
        circle.setCenterY(200.0);
        root.getChildren().add(circle);

        TranslateTransition transition = new TranslateTransition(new Duration(5000.0), circle);
        transition.setToX(700.0);
        transition.setAutoReverse(true);
        transition.setCycleCount(10);
        transition.setInterpolator(Interpolator.LINEAR);

        stage.setVisible(true);

        transition.playFromStart();
    }

    public static void main(String[] args) {
        Application.launch(args);
    }
}
I still have the same problem.

Could someone run it on their machine please and tell me if it is jerky for them.

What I'm actually seeing is about 11 jerks per movement across the screen.

Thanks, Nick.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2011
Added on May 27 2011
16 comments
907 views