Example usage for javafx.scene.shape Circle relocate

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

Introduction

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

Prototype

public void relocate(double x, double y) 

Source Link

Document

Sets the node's layoutX and layoutY translation properties in order to relocate this node to the x,y location in the parent.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);//  ww w.ja  va2  s.  c o  m
    stage.setTitle("");

    VBox vb = new VBox();

    Pane canvas = new Pane();
    canvas.setStyle("-fx-background-color: black;");
    canvas.setPrefSize(200, 200);
    Circle circle = new Circle(50, Color.BLUE);
    circle.relocate(20, 20);
    Rectangle rectangle = new Rectangle(100, 100, Color.RED);
    rectangle.relocate(70, 70);
    canvas.getChildren().addAll(circle, rectangle);

    vb.getChildren().add(canvas);

    scene.setRoot(vb);
    stage.show();
}