Example usage for javafx.beans.property SimpleDoubleProperty SimpleDoubleProperty

List of usage examples for javafx.beans.property SimpleDoubleProperty SimpleDoubleProperty

Introduction

In this page you can find the example usage for javafx.beans.property SimpleDoubleProperty SimpleDoubleProperty.

Prototype

public SimpleDoubleProperty() 

Source Link

Document

The constructor of DoubleProperty

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    DoubleProperty translate = new SimpleDoubleProperty();
    stage.setTitle("Hello JavaFX");
    Rectangle node1 = RectangleBuilder.create().x(0).y(0).width(10).height(10).fill(Color.RED).build();
    node1.translateXProperty().bind(translate);

    Parent parent = GroupBuilder.create().children(node1).translateX(250).translateY(250).build();
    stage.setScene(SceneBuilder.create().width(500).height(500).root(parent).build());
    stage.show();// ww w . ja  v a  2s. c  o m

    TimelineBuilder.create().cycleCount(Timeline.INDEFINITE)
            .keyFrames(new KeyFrame(Duration.seconds(0), new KeyValue(translate, -50)),
                    new KeyFrame(Duration.seconds(2), new KeyValue(translate, 250)))
            .build().play();
}