Spec-Zone.ru › OpenJavaFX 24

Class TilePane

java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.layout.Pane
javafx.scene.layout.TilePane
All Implemented Interfaces:
Styleable, EventTarget
public class TilePane extends Pane
TilePane lays out its children in a grid of uniformly sized "tiles".

A horizontal tilepane (the default) will tile nodes in rows, wrapping at the tilepane's width. A vertical tilepane will tile nodes in columns, wrapping at the tilepane's height.

The size of each "tile" defaults to the size needed to encompass the largest preferred width and height of the tilepane's children and the tilepane will recompute the size of the tiles as needed to accommodate the largest preferred size of its children as it changes. The application may also control the size of the tiles directly by setting prefTileWidth/prefTileHeight properties to a value other than USE_COMPUTED_SIZE (the default).

Applications should initialize either prefColumns (for horizontal) or prefRows (for vertical) to establish the tilepane's preferred size (the arbitrary default is 5). Note that prefColumns/prefRows is used only for calculating the preferred size and may not reflect the actual number of rows or columns, which may change as the tilepane is resized and the tiles are wrapped at its actual boundaries.

The alignment property controls how the rows and columns are aligned within the bounds of the tilepane and defaults to Pos.TOP_LEFT. It is also possible to control the alignment of nodes within the individual tiles by setting tileAlignment, which defaults to Pos.CENTER.

A horizontal tilepane example:


    TilePane tile = new TilePane();
    tile.setHgap(8);
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new ImageView(...));
    }
 

A vertical TilePane example:


    TilePane tile = new TilePane(Orientation.VERTICAL);
    tile.setTileAlignment(Pos.CENTER_LEFT);
    tile.setPrefRows(10);
    for (int i = 0; i < 50; i++) {
        tile.getChildren().add(new ImageView(...));
    }
 
The TilePane will attempt to resize each child to fill its tile. If the child could not be sized to fill the tile (either because it was not resizable or its size limits prevented it) then it will be aligned within the tile using tileAlignment.

Resizable Range

A tilepane's parent will resize the tilepane within the tilepane's resizable range during layout. By default the tilepane computes this range based on its content as outlined in the tables below.

Horizontal
width height
minimum left/right insets plus the tile width. top/bottom insets plus height required to display all tiles when wrapped at a specified width with a vgap between each row.
preferred left/right insets plus prefColumns multiplied by the tile width. top/bottom insets plus height required to display all tiles when wrapped at a specified width with a vgap between each row.
maximum Double.MAX_VALUE Double.MAX_VALUE

Vertical
width height
minimum left/right insets plus width required to display all tiles when wrapped at a specified height with an hgap between each column. top/bottom insets plus the tile height.
preferred left/right insets plus width required to display all tiles when wrapped at the specified height with an hgap between each column. top/bottom insets plus prefRows multiplied by the tile height.
maximum Double.MAX_VALUE Double.MAX_VALUE

A tilepane's unbounded maximum width and height are an indication to the parent that it may be resized beyond its preferred size to fill whatever space is assigned to it.

TilePane provides properties for setting the size range directly. These properties default to the sentinel value Region.USE_COMPUTED_SIZE, however the application may set them to other values as needed:


     tilePane.setMaxWidth(500);
 
Applications may restore the computed values by setting these properties back to Region.USE_COMPUTED_SIZE.

TilePane does not clip its content by default, so it is possible that children's' bounds may extend outside the tiles (and possibly the tilepane bounds) if a child's pref size prevents it from being fit within its tile. Also, if the tilepane is resized smaller than its preferred size, it may not be able to fit all the tiles within its bounds and the content will extend outside.

Optional Layout Constraints

An application may set constraints on individual children to customize TilePane's layout. For each constraint, TilePane provides a static method for setting it on the child.

TilePane Constraint Table
Constraint Type Description
alignment javafx.geometry.Pos The alignment of the child within its tile.
margin javafx.geometry.Insets Margin space around the outside of the child.

Example:


     TilePane tilepane = new TilePane();
     for (int i = 0; i < 20; i++) {
        Label title = new Label(imageTitle[i]):
        Imageview imageview = new ImageView(new Image(imageName[i]));
        TilePane.setAlignment(label, Pos.BOTTOM_RIGHT);
        tilepane.getChildren().addAll(title, imageview);
     }
 
Since:
JavaFX 2.0

Property Summary

Type Property Description
final ObjectProperty<Pos> alignment
The overall alignment of the tilepane's content within its width and height.
final DoubleProperty hgap
The amount of horizontal space between each tile in a row.
final ObjectProperty<Orientation> orientation
The orientation of this tilepane.
final IntegerProperty prefColumns
The preferred number of columns for a horizontal tilepane.
final IntegerProperty prefRows
The preferred number of rows for a vertical tilepane.
final DoubleProperty prefTileHeight
The preferred height of each tile.
final DoubleProperty prefTileWidth
The preferred width of each tile.
final ObjectProperty<Pos> tileAlignment
The default alignment of each child within its tile.
final ReadOnlyDoubleProperty tileHeight
The actual height of each tile.
final ReadOnlyDoubleProperty tileWidth
The actual width of each tile.
final DoubleProperty vgap
The amount of vertical space between each tile in a column.

Properties declared in class javafx.scene.layout.Region

background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width

Properties declared in class javafx.scene.Parent

needsLayout

Properties declared in class javafx.scene.Node

accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible

Field Summary

Fields declared in class javafx.scene.layout.Region

USE_COMPUTED_SIZE, USE_PREF_SIZE

Fields declared in class javafx.scene.Node

BASELINE_OFFSET_SAME_AS_HEIGHT

Constructor Summary

Constructor Description
TilePane()
Creates a horizontal TilePane layout with prefColumn = 5 and hgap/vgap = 0.
TilePane(double hgap, double vgap)
Creates a horizontal TilePane layout with prefColumn = 5 and the specified hgap/vgap.
TilePane(double hgap, double vgap, Node... children)
Creates a horizontal TilePane layout with prefColumn = 5 and the specified hgap/vgap.
TilePane(Orientation orientation)
Creates a TilePane layout with the specified orientation, prefColumn/prefRows = 5 and hgap/vgap = 0.
TilePane(Orientation orientation, double hgap, double vgap)
Creates a TilePane layout with the specified orientation, hgap/vgap, and prefRows/prefColumns = 5.
TilePane(Orientation orientation, double hgap, double vgap, Node... children)
Creates a TilePane layout with the specified orientation, hgap/vgap, and prefRows/prefColumns = 5.
TilePane(Orientation orientation, Node... children)
Creates a TilePane layout with the specified orientation, prefColumn/prefRows = 5 and hgap/vgap = 0.
TilePane(Node... children)
Creates a horizontal TilePane layout with prefColumn = 5 and hgap/vgap = 0.

Method Summary

Modifier and Type Method Description
final ObjectProperty<Pos> alignmentProperty()
The overall alignment of the tilepane's content within its width and height.
static void clearConstraints(Node child)
Removes all tilepane constraints from the child node.
final Pos getAlignment()
Gets the value of the alignment property.
static Pos getAlignment(Node node)
Returns the child's alignment constraint if set.
static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.
List<CssMetaData<? extends Styleable,?>> getCssMetaData()
This method should delegate to Node.getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.
final double getHgap()
Gets the value of the hgap property.
static Insets getMargin(Node node)
Returns the child's margin constraint if set.
final Orientation getOrientation()
Gets the value of the orientation property.
final int getPrefColumns()
Gets the value of the prefColumns property.
final int getPrefRows()
Gets the value of the prefRows property.
final double getPrefTileHeight()
Gets the value of the prefTileHeight property.
final double getPrefTileWidth()
Gets the value of the prefTileWidth property.
final Pos getTileAlignment()
Gets the value of the tileAlignment property.
final double getTileHeight()
Gets the value of the tileHeight property.
final double getTileWidth()
Gets the value of the tileWidth property.
final double getVgap()
Gets the value of the vgap property.
final DoubleProperty hgapProperty()
The amount of horizontal space between each tile in a row.
final ObjectProperty<Orientation> orientationProperty()
The orientation of this tilepane.
final IntegerProperty prefColumnsProperty()
The preferred number of columns for a horizontal tilepane.
final IntegerProperty prefRowsProperty()
The preferred number of rows for a vertical tilepane.
final DoubleProperty prefTileHeightProperty()
The preferred height of each tile.
final DoubleProperty prefTileWidthProperty()
The preferred width of each tile.
final void setAlignment(Pos value)
Sets the value of the alignment property.
static void setAlignment(Node node, Pos value)
Sets the alignment for the child when contained by a tilepane.
final void setHgap(double value)
Sets the value of the hgap property.
static void setMargin(Node node, Insets value)
Sets the margin for the child when contained by a tilepane.
final void setOrientation(Orientation value)
Sets the value of the orientation property.
final void setPrefColumns(int value)
Sets the value of the prefColumns property.
final void setPrefRows(int value)
Sets the value of the prefRows property.
final void setPrefTileHeight(double value)
Sets the value of the prefTileHeight property.
final void setPrefTileWidth(double value)
Sets the value of the prefTileWidth property.
final void setTileAlignment(Pos value)
Sets the value of the tileAlignment property.
final void setVgap(double value)
Sets the value of the vgap property.
final ObjectProperty<Pos> tileAlignmentProperty()
The default alignment of each child within its tile.
final ReadOnlyDoubleProperty tileHeightProperty()
The actual height of each tile.
final ReadOnlyDoubleProperty tileWidthProperty()
The actual width of each tile.
final DoubleProperty vgapProperty()
The amount of vertical space between each tile in a column.

Methods declared in class javafx.scene.layout.Pane

getChildren

Methods declared in class javafx.scene.layout.Region

backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty

Methods declared in class javafx.scene.Parent

getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds

Methods declared in class javafx.scene.Node

accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, requestFocusTraversal, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty

Methods declared in class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Methods declared in interface javafx.css.Styleable

getStyleableNode

Property Details

orientation

public final ObjectProperty<Orientation> orientationProperty
The orientation of this tilepane. A horizontal tilepane lays out children in tiles, left to right, wrapping tiles at the tilepane's width boundary. A vertical tilepane lays out children in tiles, top to bottom, wrapping at the tilepane's height. The default is horizontal.
See Also:
  • getOrientation()
  • setOrientation(Orientation)
  • orientationProperty()

prefRows

public final IntegerProperty prefRowsProperty
The preferred number of rows for a vertical tilepane. This value is used only to compute the preferred size of the tilepane and may not reflect the actual number of rows, which may change if the tilepane is resized to something other than its preferred height. This property is ignored for a horizontal tilepane.

It is recommended that the application initialize this value for a vertical tilepane.

See Also:
  • getPrefRows()
  • setPrefRows(int)
  • prefRowsProperty()

prefColumns

public final IntegerProperty prefColumnsProperty
The preferred number of columns for a horizontal tilepane. This value is used only to compute the preferred size of the tilepane and may not reflect the actual number of rows, which may change if the tilepane is resized to something other than its preferred height. This property is ignored for a vertical tilepane.

It is recommended that the application initialize this value for a horizontal tilepane.

See Also:
  • getPrefColumns()
  • setPrefColumns(int)
  • prefColumnsProperty()

prefTileWidth

public final DoubleProperty prefTileWidthProperty
The preferred width of each tile. If equal to USE_COMPUTED_SIZE (the default) the tile width will be automatically recomputed by the tilepane when the preferred size of children changes to accommodate the widest child. If the application sets this property to value greater than 0, then tiles will be set to that width and the tilepane will attempt to resize children to fit within that width (if they are resizable and their min-max width range allows it).
See Also:
  • getPrefTileWidth()
  • setPrefTileWidth(double)
  • prefTileWidthProperty()

prefTileHeight

public final DoubleProperty prefTileHeightProperty
The preferred height of each tile. If equal to USE_COMPUTED_SIZE (the default) the tile height will be automatically recomputed by the tilepane when the preferred size of children changes to accommodate the tallest child. If the application sets this property to value greater than 0, then tiles will be set to that height and the tilepane will attempt to resize children to fit within that height (if they are resizable and their min-max height range allows it).
See Also:
  • getPrefTileHeight()
  • setPrefTileHeight(double)
  • prefTileHeightProperty()

tileWidth

public final ReadOnlyDoubleProperty tileWidthProperty
The actual width of each tile. This property is read-only.
See Also:
  • getTileWidth()
  • tileWidthProperty()

tileHeight

public final ReadOnlyDoubleProperty tileHeightProperty
The actual height of each tile. This property is read-only.
See Also:
  • getTileHeight()
  • tileHeightProperty()

hgap

public final DoubleProperty hgapProperty
The amount of horizontal space between each tile in a row.
See Also:
  • getHgap()
  • setHgap(double)
  • hgapProperty()

vgap

public final DoubleProperty vgapProperty
The amount of vertical space between each tile in a column.
See Also:
  • getVgap()
  • setVgap(double)
  • vgapProperty()

alignment

public final ObjectProperty<Pos> alignmentProperty
The overall alignment of the tilepane's content within its width and height.

For a horizontal tilepane, each row will be aligned within the tilepane's width using the alignment's hpos value, and the rows will be aligned within the tilepane's height using the alignment's vpos value.

For a vertical tilepane, each column will be aligned within the tilepane's height using the alignment's vpos value, and the columns will be aligned within the tilepane's width using the alignment's hpos value.

See Also:
  • getAlignment()
  • setAlignment(Pos)
  • alignmentProperty()

tileAlignment

public final ObjectProperty<Pos> tileAlignmentProperty
The default alignment of each child within its tile. This may be overridden on individual children by setting the child's alignment constraint.
See Also:
  • getTileAlignment()
  • setTileAlignment(Pos)
  • tileAlignmentProperty()

Constructor Details

TilePane

public TilePane()
Creates a horizontal TilePane layout with prefColumn = 5 and hgap/vgap = 0.

TilePane

public TilePane(Orientation orientation)
Creates a TilePane layout with the specified orientation, prefColumn/prefRows = 5 and hgap/vgap = 0.
Parameters:
orientation - the direction the tiles should flow & wrap

TilePane

public TilePane(double hgap, double vgap)
Creates a horizontal TilePane layout with prefColumn = 5 and the specified hgap/vgap.
Parameters:
hgap - the amount of horizontal space between each tile
vgap - the amount of vertical space between each tile

TilePane

public TilePane(Orientation orientation, double hgap, double vgap)
Creates a TilePane layout with the specified orientation, hgap/vgap, and prefRows/prefColumns = 5.
Parameters:
orientation - the direction the tiles should flow & wrap
hgap - the amount of horizontal space between each tile
vgap - the amount of vertical space between each tile

TilePane

public TilePane(Node... children)
Creates a horizontal TilePane layout with prefColumn = 5 and hgap/vgap = 0.
Parameters:
children - The initial set of children for this pane.
Since:
JavaFX 8.0

TilePane

public TilePane(Orientation orientation, Node... children)
Creates a TilePane layout with the specified orientation, prefColumn/prefRows = 5 and hgap/vgap = 0.
Parameters:
orientation - the direction the tiles should flow & wrap
children - The initial set of children for this pane.
Since:
JavaFX 8.0

TilePane

public TilePane(double hgap, double vgap, Node... children)
Creates a horizontal TilePane layout with prefColumn = 5 and the specified hgap/vgap.
Parameters:
hgap - the amount of horizontal space between each tile
vgap - the amount of vertical space between each tile
children - The initial set of children for this pane.
Since:
JavaFX 8.0

TilePane

public TilePane(Orientation orientation, double hgap, double vgap, Node... children)
Creates a TilePane layout with the specified orientation, hgap/vgap, and prefRows/prefColumns = 5.
Parameters:
orientation - the direction the tiles should flow & wrap
hgap - the amount of horizontal space between each tile
vgap - the amount of vertical space between each tile
children - The initial set of children for this pane.
Since:
JavaFX 8.0

Method Details

setAlignment

public static void setAlignment(Node node, Pos value)
Sets the alignment for the child when contained by a tilepane. If set, will override the tilepane's default alignment for children within their 'tiles'. Setting the value to null will remove the constraint.
Parameters:
node - the child node of a tilepane
value - the alignment position for the child

getAlignment

public static Pos getAlignment(Node node)
Returns the child's alignment constraint if set.
Parameters:
node - the child node of a tilepane
Returns:
the alignment position for the child or null if no alignment was set

setMargin

public static void setMargin(Node node, Insets value)
Sets the margin for the child when contained by a tilepane. If set, the tilepane will layout the child with the margin space around it. Setting the value to null will remove the constraint.
Parameters:
node - the child node of a tilepane
value - the margin of space around the child

getMargin

public static Insets getMargin(Node node)
Returns the child's margin constraint if set.
Parameters:
node - the child node of a tilepane
Returns:
the margin for the child or null if no margin was set

clearConstraints

public static void clearConstraints(Node child)
Removes all tilepane constraints from the child node.
Parameters:
child - the child node

orientationProperty

public final ObjectProperty<Orientation> orientationProperty()
The orientation of this tilepane. A horizontal tilepane lays out children in tiles, left to right, wrapping tiles at the tilepane's width boundary. A vertical tilepane lays out children in tiles, top to bottom, wrapping at the tilepane's height. The default is horizontal.
Returns:
the orientation of this tilepane
See Also:
  • getOrientation()
  • setOrientation(Orientation)

setOrientation

public final void setOrientation(Orientation value)
Sets the value of the orientation property.
Property description:
The orientation of this tilepane. A horizontal tilepane lays out children in tiles, left to right, wrapping tiles at the tilepane's width boundary. A vertical tilepane lays out children in tiles, top to bottom, wrapping at the tilepane's height. The default is horizontal.
Parameters:
value - the value for the orientation property
See Also:
  • getOrientation()
  • orientationProperty()

getOrientation

public final Orientation getOrientation()
Gets the value of the orientation property.
Property description:
The orientation of this tilepane. A horizontal tilepane lays out children in tiles, left to right, wrapping tiles at the tilepane's width boundary. A vertical tilepane lays out children in tiles, top to bottom, wrapping at the tilepane's height. The default is horizontal.
Returns:
the value of the orientation property
See Also:
  • setOrientation(Orientation)
  • orientationProperty()

prefRowsProperty

public final IntegerProperty prefRowsProperty()
The preferred number of rows for a vertical tilepane. This value is used only to compute the preferred size of the tilepane and may not reflect the actual number of rows, which may change if the tilepane is resized to something other than its preferred height. This property is ignored for a horizontal tilepane.

It is recommended that the application initialize this value for a vertical tilepane.

Returns:
the preferred number of rows for a vertical tilepane
See Also:
  • getPrefRows()
  • setPrefRows(int)

setPrefRows

public final void setPrefRows(int value)
Sets the value of the prefRows property.
Property description:
The preferred number of rows for a vertical tilepane. This value is used only to compute the preferred size of the tilepane and may not reflect the actual number of rows, which may change if the tilepane is resized to something other than its preferred height. This property is ignored for a horizontal tilepane.

It is recommended that the application initialize this value for a vertical tilepane.

Parameters:
value - the value for the prefRows property
See Also:
  • getPrefRows()
  • prefRowsProperty()

getPrefRows

public final int getPrefRows()
Gets the value of the prefRows property.
Property description:
The preferred number of rows for a vertical tilepane. This value is used only to compute the preferred size of the tilepane and may not reflect the actual number of rows, which may change if the tilepane is resized to something other than its preferred height. This property is ignored for a horizontal tilepane.

It is recommended that the application initialize this value for a vertical tilepane.

Returns:
the value of the prefRows property
See Also:
  • setPrefRows(int)
  • prefRowsProperty()

prefColumnsProperty

public final IntegerProperty prefColumnsProperty()
The preferred number of columns for a horizontal tilepane. This value is used only to compute the preferred size of the tilepane and may not reflect the actual number of rows, which may change if the tilepane is resized to something other than its preferred height. This property is ignored for a vertical tilepane.

It is recommended that the application initialize this value for a horizontal tilepane.

Returns:
the preferred number of columns for a horizontal tilepane
See Also:
  • getPrefColumns()
  • setPrefColumns(int)

setPrefColumns

public final void setPrefColumns(int value)
Sets the value of the prefColumns property.
Property description:
The preferred number of columns for a horizontal tilepane. This value is used only to compute the preferred size of the tilepane and may not reflect the actual number of rows, which may change if the tilepane is resized to something other than its preferred height. This property is ignored for a vertical tilepane.

It is recommended that the application initialize this value for a horizontal tilepane.

Parameters:
value - the value for the prefColumns property
See Also:
  • getPrefColumns()
  • prefColumnsProperty()

getPrefColumns

public final int getPrefColumns()
Gets the value of the prefColumns property.
Property description:
The preferred number of columns for a horizontal tilepane. This value is used only to compute the preferred size of the tilepane and may not reflect the actual number of rows, which may change if the tilepane is resized to something other than its preferred height. This property is ignored for a vertical tilepane.

It is recommended that the application initialize this value for a horizontal tilepane.

Returns:
the value of the prefColumns property
See Also:
  • setPrefColumns(int)
  • prefColumnsProperty()

prefTileWidthProperty

public final DoubleProperty prefTileWidthProperty()
The preferred width of each tile. If equal to USE_COMPUTED_SIZE (the default) the tile width will be automatically recomputed by the tilepane when the preferred size of children changes to accommodate the widest child. If the application sets this property to value greater than 0, then tiles will be set to that width and the tilepane will attempt to resize children to fit within that width (if they are resizable and their min-max width range allows it).
Returns:
the preferred width of each tile
See Also:
  • getPrefTileWidth()
  • setPrefTileWidth(double)

setPrefTileWidth

public final void setPrefTileWidth(double value)
Sets the value of the prefTileWidth property.
Property description:
The preferred width of each tile. If equal to USE_COMPUTED_SIZE (the default) the tile width will be automatically recomputed by the tilepane when the preferred size of children changes to accommodate the widest child. If the application sets this property to value greater than 0, then tiles will be set to that width and the tilepane will attempt to resize children to fit within that width (if they are resizable and their min-max width range allows it).
Parameters:
value - the value for the prefTileWidth property
See Also:
  • getPrefTileWidth()
  • prefTileWidthProperty()

getPrefTileWidth

public final double getPrefTileWidth()
Gets the value of the prefTileWidth property.
Property description:
The preferred width of each tile. If equal to USE_COMPUTED_SIZE (the default) the tile width will be automatically recomputed by the tilepane when the preferred size of children changes to accommodate the widest child. If the application sets this property to value greater than 0, then tiles will be set to that width and the tilepane will attempt to resize children to fit within that width (if they are resizable and their min-max width range allows it).
Returns:
the value of the prefTileWidth property
See Also:
  • setPrefTileWidth(double)
  • prefTileWidthProperty()

prefTileHeightProperty

public final DoubleProperty prefTileHeightProperty()
The preferred height of each tile. If equal to USE_COMPUTED_SIZE (the default) the tile height will be automatically recomputed by the tilepane when the preferred size of children changes to accommodate the tallest child. If the application sets this property to value greater than 0, then tiles will be set to that height and the tilepane will attempt to resize children to fit within that height (if they are resizable and their min-max height range allows it).
Returns:
the preferred height of each tile
See Also:
  • getPrefTileHeight()
  • setPrefTileHeight(double)

setPrefTileHeight

public final void setPrefTileHeight(double value)
Sets the value of the prefTileHeight property.
Property description:
The preferred height of each tile. If equal to USE_COMPUTED_SIZE (the default) the tile height will be automatically recomputed by the tilepane when the preferred size of children changes to accommodate the tallest child. If the application sets this property to value greater than 0, then tiles will be set to that height and the tilepane will attempt to resize children to fit within that height (if they are resizable and their min-max height range allows it).
Parameters:
value - the value for the prefTileHeight property
See Also:
  • getPrefTileHeight()
  • prefTileHeightProperty()

getPrefTileHeight

public final double getPrefTileHeight()
Gets the value of the prefTileHeight property.
Property description:
The preferred height of each tile. If equal to USE_COMPUTED_SIZE (the default) the tile height will be automatically recomputed by the tilepane when the preferred size of children changes to accommodate the tallest child. If the application sets this property to value greater than 0, then tiles will be set to that height and the tilepane will attempt to resize children to fit within that height (if they are resizable and their min-max height range allows it).
Returns:
the value of the prefTileHeight property
See Also:
  • setPrefTileHeight(double)
  • prefTileHeightProperty()

tileWidthProperty

public final ReadOnlyDoubleProperty tileWidthProperty()
The actual width of each tile. This property is read-only.
Returns:
the actual width of each tile
See Also:
  • getTileWidth()

getTileWidth

public final double getTileWidth()
Gets the value of the tileWidth property.
Property description:
The actual width of each tile. This property is read-only.
Returns:
the value of the tileWidth property
See Also:
  • tileWidthProperty()

tileHeightProperty

public final ReadOnlyDoubleProperty tileHeightProperty()
The actual height of each tile. This property is read-only.
Returns:
the actual height of each tile
See Also:
  • getTileHeight()

getTileHeight

public final double getTileHeight()
Gets the value of the tileHeight property.
Property description:
The actual height of each tile. This property is read-only.
Returns:
the value of the tileHeight property
See Also:
  • tileHeightProperty()

hgapProperty

public final DoubleProperty hgapProperty()
The amount of horizontal space between each tile in a row.
Returns:
the amount of horizontal space between each tile in a row
See Also:
  • getHgap()
  • setHgap(double)

setHgap

public final void setHgap(double value)
Sets the value of the hgap property.
Property description:
The amount of horizontal space between each tile in a row.
Parameters:
value - the value for the hgap property
See Also:
  • getHgap()
  • hgapProperty()

getHgap

public final double getHgap()
Gets the value of the hgap property.
Property description:
The amount of horizontal space between each tile in a row.
Returns:
the value of the hgap property
See Also:
  • setHgap(double)
  • hgapProperty()

vgapProperty

public final DoubleProperty vgapProperty()
The amount of vertical space between each tile in a column.
Returns:
the amount of vertical space between each tile in a column
See Also:
  • getVgap()
  • setVgap(double)

setVgap

public final void setVgap(double value)
Sets the value of the vgap property.
Property description:
The amount of vertical space between each tile in a column.
Parameters:
value - the value for the vgap property
See Also:
  • getVgap()
  • vgapProperty()

getVgap

public final double getVgap()
Gets the value of the vgap property.
Property description:
The amount of vertical space between each tile in a column.
Returns:
the value of the vgap property
See Also:
  • setVgap(double)
  • vgapProperty()

alignmentProperty

public final ObjectProperty<Pos> alignmentProperty()
The overall alignment of the tilepane's content within its width and height.

For a horizontal tilepane, each row will be aligned within the tilepane's width using the alignment's hpos value, and the rows will be aligned within the tilepane's height using the alignment's vpos value.

For a vertical tilepane, each column will be aligned within the tilepane's height using the alignment's vpos value, and the columns will be aligned within the tilepane's width using the alignment's hpos value.

Returns:
the overall alignment of the tilepane's content within its width and height
See Also:
  • getAlignment()
  • setAlignment(Pos)

setAlignment

public final void setAlignment(Pos value)
Sets the value of the alignment property.
Property description:
The overall alignment of the tilepane's content within its width and height.

For a horizontal tilepane, each row will be aligned within the tilepane's width using the alignment's hpos value, and the rows will be aligned within the tilepane's height using the alignment's vpos value.

For a vertical tilepane, each column will be aligned within the tilepane's height using the alignment's vpos value, and the columns will be aligned within the tilepane's width using the alignment's hpos value.

Parameters:
value - the value for the alignment property
See Also:
  • getAlignment()
  • alignmentProperty()

getAlignment

public final Pos getAlignment()
Gets the value of the alignment property.
Property description:
The overall alignment of the tilepane's content within its width and height.

For a horizontal tilepane, each row will be aligned within the tilepane's width using the alignment's hpos value, and the rows will be aligned within the tilepane's height using the alignment's vpos value.

For a vertical tilepane, each column will be aligned within the tilepane's height using the alignment's vpos value, and the columns will be aligned within the tilepane's width using the alignment's hpos value.

Returns:
the value of the alignment property
See Also:
  • setAlignment(Pos)
  • alignmentProperty()

tileAlignmentProperty

public final ObjectProperty<Pos> tileAlignmentProperty()
The default alignment of each child within its tile. This may be overridden on individual children by setting the child's alignment constraint.
Returns:
the default alignment of each child within its tile
See Also:
  • getTileAlignment()
  • setTileAlignment(Pos)

setTileAlignment

public final void setTileAlignment(Pos value)
Sets the value of the tileAlignment property.
Property description:
The default alignment of each child within its tile. This may be overridden on individual children by setting the child's alignment constraint.
Parameters:
value - the value for the tileAlignment property
See Also:
  • getTileAlignment()
  • tileAlignmentProperty()

getTileAlignment

public final Pos getTileAlignment()
Gets the value of the tileAlignment property.
Property description:
The default alignment of each child within its tile. This may be overridden on individual children by setting the child's alignment constraint.
Returns:
the value of the tileAlignment property
See Also:
  • setTileAlignment(Pos)
  • tileAlignmentProperty()

getClassCssMetaData

public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.
Returns:
the CssMetaData
Since:
JavaFX 8.0

getCssMetaData

public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
This method should delegate to Node.getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.
Specified by:
getCssMetaData in interface Styleable
Overrides:
getCssMetaData in class Region
Returns:
The CssMetaData associated with this node, which may include the CssMetaData of its superclasses.
Since:
JavaFX 8.0

Report a bug or suggest an enhancement
Copyright © 2008, 2025, Oracle and/or its affiliates. All rights reserved.

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API