Example usage for javafx.scene.shape LineTo LineTo

List of usage examples for javafx.scene.shape LineTo LineTo

Introduction

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

Prototype

public LineTo() 

Source Link

Document

Creates an empty instance of LineTo.

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Shapes");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 300, Color.WHITE);

    Path path = new Path();

    QuadCurveTo quadCurveTo = new QuadCurveTo();
    quadCurveTo.setX(50);//  w  w w  .jav a  2  s. c om
    quadCurveTo.setY(50);
    quadCurveTo.setControlX(10);
    quadCurveTo.setControlY(50);

    LineTo lineTo1 = new LineTo();
    lineTo1.setX(150);
    lineTo1.setY(150);

    LineTo lineTo2 = new LineTo();
    lineTo2.setX(100);
    lineTo2.setY(200);

    LineTo lineTo3 = new LineTo();
    lineTo3.setX(350);
    lineTo3.setY(150);

    MoveTo moveTo = new MoveTo();
    moveTo.setX(50);
    moveTo.setY(150);

    path.getElements().add(moveTo);
    path.getElements().add(quadCurveTo);
    path.getElements().add(lineTo1);
    path.getElements().add(lineTo2);
    path.getElements().add(lineTo3);
    path.setTranslateY(30);
    path.setStrokeWidth(3);
    path.setStroke(Color.BLACK);

    root.getChildren().add(path);

    primaryStage.setScene(scene);
    primaryStage.show();
}