package test.scenegraph.app; import javafx.scene.Scene; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import javafx.application.Application; import javafx.geometry.HPos; import javafx.geometry.VPos; import javafx.scene.layout.GridPane; import javafx.scene.layout.RowConstraints; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; public class ShortAppWithoutDependencies511 extends Application { @Override public void start(Stage stage) { GridPane pane = new GridPane(); stage.setScene(new Scene(pane, 400,200)); stage.setVisible(true); pane.setStyle("-fx-border-color: darkgray;"); pane.setPrefSize(130, 130); pane.setGridLinesVisible(false); RowConstraints rc1 = new RowConstraints(); rc1.setFillHeight(false); pane.getRowConstraints().add(rc1); StackPane sp2 = new StackPane(); sp2.setPrefSize(10,10); sp2.setMaxSize(60,60); sp2.setStyle("-fx-border-color: red;"); GridPane.setConstraints(sp2, 0, 0); GridPane.setHalignment(sp2,HPos.CENTER); GridPane.setValignment(sp2,VPos.CENTER); Rectangle r1 = new Rectangle(12,110); GridPane.setConstraints(r1, 1, 0); r1.setFill(Color.BLUE); Rectangle r2 = new Rectangle(110,12); GridPane.setConstraints(r2, 0, 1); r2.setFill(Color.GREEN); pane.getChildren().addAll(sp2, r1, r2); } public static void main(String args[]) { Application.launch(ShortAppWithoutDependencies511.class, args); } }