List of usage examples for javafx.scene.shape Rectangle setStyle
public final void setStyle(String value)
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(); }