Java Reference
In-Depth Information
Figure 5-12. Reversi application with a GridPane to display the board and pieces
Aligning and Stretching with AnchorPane
The last built-in layout is the AnchorPane . It is a fairly specialized layout that serves two related purposes. When used
with one or two nonopposing constraints, it can be used to align the child to a particular corner of the layout with a set
stand-off. The other purpose is to stretch the child horizontally, vertically, both by setting opposing constraints, again
with an optional stand-off from the parent edges as shown in Figure 5-13 .
Figure 5-13. AnchorPane constraints for a child Node (solid line) in a Parent (dashed line)
The AnchorPane works by accepting a list of children that are displayed in stack order, each of which can
optionally specify constraints for left, right, top, and bottom anchors. If no anchors are specified, it will position
children at the top left of the container. Once an anchor is set, it will align to a set distance away from that edge and get
the minimum of the preferred size and the container size.
 
Search WWH ::




Custom Search