BorderPane suggests several positions to align each subnode: top, bottom, left, right, or center:
Refer to the following code:
BorderPane root = new BorderPane();root.setRight(new Text("Right "));root.setCenter(new Text("Center"));root.setBottom(new Text(" Bottom"));root.setLeft(new Text(" Left"));Text top = new Text("Top");root.setTop(top);BorderPane.setAlignment(top, Pos.CENTER);
Note the last line, where the static method is used to adjust top-element horizontal alignment. This is a JavaFX-specific approach to set Pane constraints.