Example usage for javafx.scene.shape Rectangle getStrokeDashArray

List of usage examples for javafx.scene.shape Rectangle getStrokeDashArray

Introduction

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

Prototype

public final ObservableList<Double> getStrokeDashArray() 

Source Link

Document

Defines the array representing the lengths of the dash segments.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 500, 200);
    stage.setScene(scene);//from   www.  j  a va2  s .c  o m

    Rectangle rect = new Rectangle(100, 100);
    rect.setLayoutX(50);
    rect.setLayoutY(50);
    rect.getStrokeDashArray().addAll(1.0, 13.0);
    ((Group) scene.getRoot()).getChildren().add(rect);

    stage.show();

}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group group = new Group();

    Rectangle rect = new Rectangle(20, 20, 200, 200);

    rect.setStrokeWidth(2);//from  w w  w . j  a va 2 s . co m

    rect.setStroke(Color.RED);
    rect.setStrokeWidth(1.5);
    rect.getStrokeDashArray().addAll(3.0, 7.0, 3.0, 7.0);

    group.getChildren().add(rect);

    Scene scene = new Scene(group, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}