Java tutorial
import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 500, 200); stage.setScene(scene); 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(); } public static void main(String[] args) { launch(args); } }