Spec-Zone .ru
спецификации, руководства, описания, API
|
public class TilePane extends Pane
Горизонталь tilepane (значение по умолчанию) разместит узлы рядом в строках, переносящихся в width tilepane. Вертикаль tilepane разместит узлы рядом в столбцах, переносящихся в height tilepane.
Размер каждой "мозаики", значения по умолчанию к размеру должны были охватить самый большой привилегированный width и height дочерних элементов tilepane и tilepane, повторно вычислит размер мозаик как необходимый разместить самый большой привилегированный размер его дочерних элементов, поскольку это изменяется. Приложение может также управлять размером мозаик непосредственно, устанавливая prefTileWidth/prefTileHeight свойства в значение кроме USE_COMPUTED_SIZE (значение по умолчанию).
Приложения должны инициализировать также prefColumns
(для горизонтали) или prefRows
(для вертикали), чтобы установить привилегированный размер tilepane (произвольное значение по умолчанию 5). Отметьте, что prefColumns/prefRows используется только для того, чтобы вычислить привилегированный размер и, возможно, не отражает фактическое число строк или столбцов, которые могут измениться, поскольку tilepane изменяется, и мозаики обертываются на его фактических границах.
Свойство выравнивания управляет, как строки и столбцы выровненные в пределах границ tilepane и значений по умолчанию к На месте продажи. TOP_LEFT. Также возможно управлять выравниванием узлов в пределах отдельных мозаик, устанавливая tileAlignment
, какие значения по умолчанию На месте продажи Центрировать.
Горизонталь tilepane пример:
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. 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 childrens' bounds may extend outside the tiles (and possibly the tilepane bounds) if a child's min 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.
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 label = new Label(imageTitle[i]):
TilePane.setAlignment(label, Pos.BOTTOM_RIGHT);
tilepane.getChildren().addAll(title, imageview[i]);
}
Type | Property and Description |
---|---|
ObjectProperty<Pos> |
выравнивание
The overall alignment of the tilepane's content within its width and height.
|
DoubleProperty |
hgap
The amount of horizontal space between each tile in a row.
|
ObjectProperty<Orientation> |
ориентация
The orientation of this tilepane.
|
IntegerProperty |
prefColumns
The preferred number of columns for a horizontal tilepane.
|
IntegerProperty |
prefRows
The preferred number of rows for a vertical tilepane.
|
DoubleProperty |
prefTileHeight
The preferred height of each tile.
|
DoubleProperty |
prefTileWidth
The preferred width of each tile.
|
ObjectProperty<Pos> |
tileAlignment
The default alignment of each child within its tile.
|
ReadOnlyDoubleProperty |
tileHeight
The actual height of each tile.
|
ReadOnlyDoubleProperty |
tileWidth
The actual width of each tile.
|
DoubleProperty |
vgap
The amount of vertical space between each tile in a column.
|
heightProperty, maxHeightProperty, maxWidthProperty, minHeightProperty, minWidthProperty, paddingProperty, prefHeightProperty, prefWidthProperty, snapToPixelProperty, widthProperty
needsLayoutProperty
blendModeProperty, boundsInLocalProperty, boundsInParentProperty, cacheHintProperty, cacheProperty, clipProperty, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectProperty, eventDispatcherProperty, focusedProperty, focusTraversableProperty, hoverProperty, idProperty, inputMethodRequestsProperty, layoutBoundsProperty, layoutXProperty, layoutYProperty, managedProperty, mouseTransparentProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDraggedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onScrollProperty, opacityProperty, parentProperty, pickOnBoundsProperty, pressedProperty, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, styleProperty, translateXProperty, translateYProperty, translateZProperty, visibleProperty
USE_COMPUTED_SIZE, USE_PREF_SIZE
Constructor and 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(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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected double |
computeMinHeight(double width)
Computes the minimum height of this region.
|
protected double |
computeMinWidth(double height)
Computes the minimum width of this region.
|
protected double |
computePrefHeight(double forWidth)
Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy.
|
protected double |
computePrefWidth(double forHeight)
Computes the preferred width of this region for the given height.
|
На месте продажи |
getAlignment()
The overall alignment of the tilepane's content within its width and height.
|
static Pos |
getAlignment(Node node)
Returns the child's alignment constraint if set.
|
Ориентация |
getContentBias()
Returns the orientation of a node's resizing bias for layout purposes.
|
double |
getHgap()
The amount of horizontal space between each tile in a row.
|
static Insets |
getMargin(Node node)
Returns the child's margin constraint if set.
|
Ориентация |
getOrientation()
The orientation of this tilepane.
|
int |
getPrefColumns()
The preferred number of columns for a horizontal tilepane.
|
int |
getPrefRows()
The preferred number of rows for a vertical tilepane.
|
double |
getPrefTileHeight()
The preferred height of each tile.
|
double |
getPrefTileWidth()
The preferred width of each tile.
|
На месте продажи |
getTileAlignment()
The default alignment of each child within its tile.
|
double |
getTileHeight()
The actual height of each tile.
|
double |
getTileWidth()
The actual width of each tile.
|
double |
getVgap()
The amount of vertical space between each tile in a column.
|
DoubleProperty |
hgapProperty()
The amount of horizontal space between each tile in a row.
|
protected void |
layoutChildren()
Invoked during the layout pass to layout the children in this region.
|
ObjectProperty<Orientation> |
orientationProperty()
The orientation of this tilepane.
|
IntegerProperty |
prefColumnsProperty()
The preferred number of columns for a horizontal tilepane.
|
IntegerProperty |
prefRowsProperty()
The preferred number of rows for a vertical tilepane.
|
DoubleProperty |
prefTileHeightProperty()
The preferred height of each tile.
|
DoubleProperty |
prefTileWidthProperty()
The preferred width of each tile.
|
void |
requestLayout()
Requests a layout pass to be performed before the next scene is rendered.
|
static void |
setAlignment(Node node, Pos value)
Sets the alignment for the child when contained by a tilepane.
|
void |
setAlignment(Pos value)
The overall alignment of the tilepane's content within its width and height.
|
void |
setHgap(double value)
The amount of horizontal space between each tile in a row.
|
static void |
setMargin(Node node, Insets value)
Sets the margin for the child when contained by a tilepane.
|
void |
setOrientation(Orientation value)
The orientation of this tilepane.
|
void |
setPrefColumns(int value)
The preferred number of columns for a horizontal tilepane.
|
void |
setPrefRows(int value)
The preferred number of rows for a vertical tilepane.
|
void |
setPrefTileHeight(double value)
The preferred height of each tile.
|
void |
setPrefTileWidth(double value)
The preferred width of each tile.
|
void |
setTileAlignment(Pos value)
The default alignment of each child within its tile.
|
void |
setVgap(double value)
The amount of vertical space between each tile in a column.
|
ObjectProperty<Pos> |
tileAlignmentProperty()
The default alignment of each child within its tile.
|
ReadOnlyDoubleProperty |
tileHeightProperty()
The actual height of each tile.
|
ReadOnlyDoubleProperty |
tileWidthProperty()
The actual width of each tile.
|
DoubleProperty |
vgapProperty()
The amount of vertical space between each tile in a column.
|
getChildren
computeMaxHeight, computeMaxWidth, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getPadding, getPrefHeight, getPrefWidth, getWidth, heightProperty, isResizable, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setSnapToPixel, setWidth, snapPosition, snapSize, snapSpace, snapToPixelProperty, widthProperty
getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, isNeedsLayout, layout, lookup, needsLayoutProperty, setNeedsLayout
addEventFilter, addEventHandler, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getCursor, getDepthTest, getEffect, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragged, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnScroll, getOpacity, getParent, getProperties, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getUserData, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToScene, localToScene, localToScene, lookupAll, managedProperty, mouseTransparentProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDraggedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onScrollProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragged, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnScroll, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, startDragAndDrop, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, visibleProperty
getOrientation()
, setOrientation(Orientation)
It is recommended that the application initialize this value for a vertical tilepane.
getPrefRows()
, setPrefRows(int)
It is recommended that the application initialize this value for a horizontal tilepane.
getPrefColumns()
, setPrefColumns(int)
getPrefTileWidth()
, setPrefTileWidth(double)
getPrefTileHeight()
, setPrefTileHeight(double)
getTileWidth()
getTileHeight()
getHgap()
, setHgap(double)
getVgap()
, setVgap(double)
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.
getAlignment()
, setAlignment(Pos)
getTileAlignment()
, setTileAlignment(Pos)
public TilePane()
public TilePane(Orientation orientation)
orientation
- the direction the tiles should flow & wrappublic TilePane(double hgap, double vgap)
hgap
- the amount of horizontal space between each tilevgap
- the amount of vertical space between each tilepublic TilePane(Orientation orientation, double hgap, double vgap)
orientation
- the direction the tiles should flow & wraphgap
- the amount of horizontal space between each tilevgap
- the amount of vertical space between each tilepublic static void setAlignment(Node node, Pos value)
node
- the child node of a tilepanevalue
- the alignment position for the childpublic static Pos getAlignment(Node node)
node
- the child node of a tilepanepublic static void setMargin(Node node, Insets value)
node
- the child node of a tilepanevalue
- the margin of space around the childpublic static Insets getMargin(Node node)
node
- the child node of a tilepanepublic static void clearConstraints(Node child)
child
- the child nodepublic final ObjectProperty<Orientation> orientationProperty()
getOrientation()
, setOrientation(Orientation)
public final void setOrientation(Orientation value)
public final Orientation getOrientation()
public final IntegerProperty prefRowsProperty()
It is recommended that the application initialize this value for a vertical tilepane.
getPrefRows()
, setPrefRows(int)
public final void setPrefRows(int value)
It is recommended that the application initialize this value for a vertical tilepane.
public final int getPrefRows()
It is recommended that the application initialize this value for a vertical tilepane.
public final IntegerProperty prefColumnsProperty()
It is recommended that the application initialize this value for a horizontal tilepane.
getPrefColumns()
, setPrefColumns(int)
public final void setPrefColumns(int value)
It is recommended that the application initialize this value for a horizontal tilepane.
public final int getPrefColumns()
It is recommended that the application initialize this value for a horizontal tilepane.
public final DoubleProperty prefTileWidthProperty()
getPrefTileWidth()
, setPrefTileWidth(double)
public final void setPrefTileWidth(double value)
public final double getPrefTileWidth()
public final DoubleProperty prefTileHeightProperty()
getPrefTileHeight()
, setPrefTileHeight(double)
public final void setPrefTileHeight(double value)
public final double getPrefTileHeight()
public final ReadOnlyDoubleProperty tileWidthProperty()
getTileWidth()
public final double getTileWidth()
public final ReadOnlyDoubleProperty tileHeightProperty()
getTileHeight()
public final double getTileHeight()
public final DoubleProperty hgapProperty()
getHgap()
, setHgap(double)
public final void setHgap(double value)
public final double getHgap()
public final DoubleProperty vgapProperty()
getVgap()
, setVgap(double)
public final void setVgap(double value)
public final double getVgap()
public final ObjectProperty<Pos> alignmentProperty()
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.
getAlignment()
, setAlignment(Pos)
public final void setAlignment(Pos value)
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.
public final Pos getAlignment()
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.
public final ObjectProperty<Pos> tileAlignmentProperty()
getTileAlignment()
, setTileAlignment(Pos)
public final void setTileAlignment(Pos value)
public final Pos getTileAlignment()
public Orientation getContentBias()
Node
Resizable subclasses should override this method to return an appropriate value.
getContentBias
in class Node
Node.isResizable()
, Node.minWidth(double)
, Node.minHeight(double)
, Node.prefWidth(double)
, Node.prefHeight(double)
, Node.maxWidth(double)
, Node.maxHeight(double)
public void requestLayout()
Parent
If this parent is either a layout root or unmanaged, then it will be added directly to the scene's dirty layout list, otherwise requestLayout will be invoked on its parent.
requestLayout
in class Parent
protected double computeMinWidth(double height)
Region
computeMinWidth
in class Region
protected double computeMinHeight(double width)
Region
computeMinHeight
in class Region
protected double computePrefWidth(double forHeight)
Region
computePrefWidth
in class Region
forHeight
- the height that should be used if preferred width depends on itprotected double computePrefHeight(double forWidth)
Region
computePrefHeight
in class Region
forWidth
- the width that should be used if preferred height depends on itprotected void layoutChildren()
Region
Subclasses should override this function to layout content as needed.
layoutChildren
in class Region
Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. Use is subject to