Example usage for javafx.scene.shape Circle centerXProperty

List of usage examples for javafx.scene.shape Circle centerXProperty

Introduction

In this page you can find the example usage for javafx.scene.shape Circle centerXProperty.

Prototype

public final DoubleProperty centerXProperty() 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Title");

    final Circle circ = new Circle(40, Color.RED);

    System.out.println(circ.centerXProperty().doubleValue());

    final Group root = new Group(circ);
    final Scene scene = new Scene(root, 400, 300);

    primaryStage.setScene(scene);/*from ww  w .j  a v  a 2s  . c  om*/
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Circle c = new Circle();
    Group root = new Group(c);
    Scene scene = new Scene(root, 100, 100);

    c.centerXProperty().bind(scene.widthProperty().divide(2));
    c.centerYProperty().bind(scene.heightProperty().divide(2));
    c.radiusProperty().bind(Bindings.min(scene.widthProperty(), scene.heightProperty()).divide(2));

    stage.setTitle("A Centered Circle");
    stage.setScene(scene);/*from w w  w . j  a va2s.  c  om*/
    stage.sizeToScene();
    stage.show();
}

From source file:Main.java

private Line connect(Circle c1, Circle c2) {
    Line line = new Line();

    line.startXProperty().bind(c1.centerXProperty());
    line.startYProperty().bind(c1.centerYProperty());

    line.endXProperty().bind(c2.centerXProperty());
    line.endYProperty().bind(c2.centerYProperty());

    line.setStrokeWidth(1);/*  www .jav  a  2s.c  o m*/
    line.setStrokeLineCap(StrokeLineCap.BUTT);
    line.getStrokeDashArray().setAll(1.0, 4.0);

    return line;
}