Example usage for javafx.scene.shape Rectangle setStyle

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

Introduction

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

Prototype

public final void setStyle(String value) 

Source Link

Document

A string representation of the CSS style associated with this specific Node .

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  v a 2s .c om

    Rectangle rect = new Rectangle(100, 100);
    rect.setLayoutX(50);
    rect.setLayoutY(50);
    rect.setStyle("-fx-fill: red; ");
    ((Group) scene.getRoot()).getChildren().add(rect);

    stage.show();

}