/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package helloworld; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; import javafx.scene.layout.RowConstraints; import javafx.stage.Stage; /** * * @author jfdenise */ public class GridPaneTest extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("Hello World!"); final GridPane gp = new GridPane(); gp.setGridLinesVisible(true); gp.getColumnConstraints().add(new ColumnConstraints(100)); gp.getColumnConstraints().add(new ColumnConstraints(200)); gp.getRowConstraints().add(new RowConstraints(40)); gp.getRowConstraints().add(new RowConstraints(50)); Button button = new Button("Test"); GridPane.setConstraints(button, 0, 0); GridPane.setRowSpan(button, 2); GridPane.setColumnSpan(button, 2); gp.getChildren().add(button); AnchorPane root = new AnchorPane(); root.getChildren().add(gp); primaryStage.setScene(new Scene(root, 400, 250)); primaryStage.show(); } }