Java Reference
In-Depth Information
Table 5-3. Layout Methods on the TilePane Class
Name
Default
Description
setPrefRows(int)
Number of rows used to calculate the preferred
height of the TilePane
setPrefColumns(int)
Number of columns used to calculate the preferred
width of the TilePane
setHGap(double)
0
Horizontal gap between the columns
setVGap(double)
0
Vertical gap between the rows
setAlignment(Pos)
Alignment of the TilePane contents
TOP_LEFT
setAlignment(Node, Pos)
Alignment of nodes added to the TilePane
setMargin(Node, Insets)
Margin used around nodes added to the TilePane
setTileAlignment(Pos)
Default alignment of nodes added to the TilePane
CENTER
setPrefTileWidth(double)
USE_COMPUTED_SIZE
Sets the preferred tile width (can be reset by setting it
back to the default)
setPrefTileHeight(double)
USE_COMPUTED_SIZE
Sets the preferred tile height (can be reset by setting
it back to the default)
setOrientation(Orientation)
HORIZONTAL
Direction in which the tiles should be laid out; can
be either HORIZONTAL or VERTICAL
setSnapToPixel(boolean)
True
Whether or not the layout will align tiles to the pixel
boundaries or use fractional tile widths
TilePane is a very versatile class with lots of options for setting the preferred tile width and height, preferred
number of rows and columns, gaps between rows and columns, and the horizontal and vertical position. Most of
these have reasonable defaults, such as preferredTileWidth and preferredTileHeight , that use the largest preferred
width/height of all its children. Similarly, rows and columns are set automatically based on the number of tiles that fit
the width and height of the TilePane .
Just like the StackPane class, TilePane also has variables for setting the default alignment and also the alignment
of each individual node added. We use the latter, because we want the text aligned to the right on one side and the left
on the other.
Rather than using separate horizontal and vertical positions like JavaFX 1.3, JavaFX 8 uses a single Pos
enumeration that contains all the combinations. Table 5-4 lists all the possible values you can pass in where a Pos is
expected.
Table 5-4. Different Combinations for the Pos Enumeration
Name
Description
TOP_LEFT
Aligns to the top-left of the container
TOP_CENTER
Aligns to the top-center of the container
TOP_RIGHT
Aligns to the top-right of the container
CENTER_LEFT
Aligns to the middle of the left side of the container
( continued )
 
Search WWH ::




Custom Search