上QQ阅读APP看书,第一时间看更新
BorderPane layout manager
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.