![Mastering JavaFX 10](https://wfqqreader-1252317822.image.myqcloud.com/cover/811/36699811/b_36699811.jpg)
上QQ阅读APP看书,第一时间看更新
BorderPane layout manager
BorderPane suggests several positions to align each subnode: top, bottom, left, right, or center:
![](https://epubservercos.yuewen.com/0A344C/19470392808882006/epubprivate/OEBPS/Images/Chapter_13.jpg?sign=1738887518-A5nefiMDJMBZu5ma6Z4H6ET2ludtdbzZ-0-87e65ed569f7569db46fe10349cba43e)
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.