Example usage for javafx.scene.shape Path setFill

List of usage examples for javafx.scene.shape Path setFill

Introduction

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

Prototype

public final void setFill(Paint value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Path pathTriangle = new Path(new MoveTo(50, 0), new LineTo(0, 50), new LineTo(100, 50), new LineTo(50, 0));

    pathTriangle.setFill(Color.LIGHTGRAY);
    pathTriangle.setStroke(Color.BLACK);

    SVGPath svgTriangle = new SVGPath();
    svgTriangle.setContent("M50, 0 L10, 20 L100, 50 Z");
    svgTriangle.setFill(Color.LIGHTGRAY);
    svgTriangle.setStroke(Color.BLACK);

    HBox root = new HBox(pathTriangle, svgTriangle);
    root.setSpacing(10);//from w  w  w  . j  a v a2  s  .c  o  m
    root.setStyle("-fx-padding: 10;" + "-fx-border-style: solid inside;" + "-fx-border-width: 2;"
            + "-fx-border-insets: 5;" + "-fx-border-radius: 5;" + "-fx-border-color: blue;");

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("2D Shapes using Path and SVGPath Classes");
    stage.show();
}