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 java-buddy.blogspot.com */ public class JavaFX_Path extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("java-buddy.blogspot.com"); 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(); imageView.setImage(image1); 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)); path.setStrokeWidth(1); path.setStroke(Color.BLACK); final PathTransition pathTransition = PathTransitionBuilder.create() .node(imageView) .path(path) .duration(Duration.millis(5000)) .orientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT) .cycleCount(1) .build(); Button btnStart = new Button("playFromStart"); btnStart.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { pathTransition.playFromStart(); } }); root.getChildren().add(btnStart); root.getChildren().add(imageView); root.getChildren().add(path); primaryStage.setScene(scene); primaryStage.show(); } }
Monday, March 5, 2012
JavaFX 2.0: PathTransition - transition along path
Subscribe to:
Post Comments (Atom)
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
ReplyDelete2.date of birth
1.phone 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 it.like way2sms registration form.
2.date of birth field.
format is dd-mm=yy
ok
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 srihari1203@gmail.com
text field is there that represents phone no for i