Monday, March 5, 2012

JavaFX 2.0: PathTransition - transition along path

package javafx_path;

import javafx.animation.PathTransition;
import javafx.animation.PathTransitionBuilder;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.stage.Stage;
import javafx.util.Duration;

 * @web
public class JavaFX_Path extends Application {
     * @param args the command line arguments
    public static void main(String[] args) {
    public void start(Stage primaryStage) {
        Group root = new Group();
        Scene scene = new Scene(root, 400, 300, Color.WHITE);
        final Image image1 = new Image(getClass().getResourceAsStream("duke_44x80.png"));
        final ImageView imageView = new ImageView();
        Path path = new Path();
        path.getElements().add(new MoveTo(50, 50));
        path.getElements().add(new LineTo(50, 200));
        path.getElements().add(new LineTo(100, 200));
        path.getElements().add(new LineTo(100, 100));
        path.getElements().add(new LineTo(200, 100));
        final PathTransition pathTransition = PathTransitionBuilder.create()
        Button btnStart = new Button("playFromStart");
        btnStart.setOnAction(new EventHandler<ActionEvent>() {
            public void handle(ActionEvent event) {


1 comment:

  1. hi i have on doubt in javafx textfield controls that for example one registration form is there in that two text fields are there 1. phone no of birth no
    the person belongs to india country code is 91 and some other country country code that should
    be disable the end user cannot modify way2sms registration form. of birth field.
    format is dd-mm=yy
    in this first two chars user can enter and 3rd char user can not modify after entering second char cursor should be move to third char.
    like after 5 th char also
    can u help to do that program
    my mail id is

    text field is there that represents phone no for i