To do this with GridPane , think that it has three columns with a width of 40%, 10%, and 50%. The top left node spans the first and second columns, the top right node only the third column. The bottom left is only in the first column, the bottom right is the second and third columns.
Sort of:
| c1 |c2| c3 | _________________________ |-----------|-----------| |--------|--------------|
In the code, do something like:
Node topLeft ; Node topRight ; Node bottomLeft ; Node bottomRight ; GridPane page = new GridPane(); // page.add(Node, colIndex, rowIndex, colSpan, rowSpan): page.add(topLeft, 0, 0, 2, 1); page.add(topRight, 2, 0, 1, 1); page.add(bottomLeft, 0, 2, 1, 1); page.add(bottomRight, 1, 1, 2, 1); ColumnConstraints col1Constraints = new ColumnConstraints(); col1Constraints.setPercentWidth(40); ColumnConstraints col2Constraints = new ColumnConstraints(); col2Constraints.setPercentWidth(10); ColumnConstraints col3Constraints = new ColumnConstraints(); col3Constraints.setPercentWidth(50); page.getColumnConstraints().addAll(col1Constraints, col2Constraints, col3Constraints);
Edit: text changed from getColumnContraints to getColumnConstraints.
source share