Spec-Zone .ru
спецификации, руководства, описания, API
|
public class FlowPane extends Pane
A horizontal flowpane (the default) will layout nodes in rows, wrapping at the flowpane's width. A vertical flowpane lays out nodes in columns, wrapping at the flowpane's height. If the flowpane has a border and/or padding set, the content will be flowed within those insets.
FlowPane's prefWrapLength property establishes it's preferred width (for horizontal) or preferred height (for vertical). Applications should set prefWrapLength if the default value (400) doesn't suffice. Note that prefWrapLength is used only for calculating the preferred size and may not reflect the actual wrapping dimension, which tracks the actual size of the flowpane.
The alignment property controls how the rows and columns are aligned within the bounds of the flowpane and defaults to Pos.TOP_LEFT. It is also possible to control the alignment of nodes within the rows and columns by setting rowValignment for horizontal or columnHalignment for vertical.
Example of a horizontal flowpane:
Image images[] = { ... };
FlowPane flow = new FlowPane();
flow.setVgap(8);
flow.setHgap(4);
flow.setPrefWrapLength(300); // preferred width = 300
for (int i = 0; i < images.length; i++) {
flow.getChildren().add(new ImageView(image[i]);
}
Example of a vertical flowpane:
FlowPane flow = new FlowPane(Orientation.VERTICAL);
flow.setColumnHalignment(HPos.LEFT); // align labels on left
flow.setPrefWrapLength(200); // preferred height = 200
for (int i = 0; i < titles.size(); i++) {
flow.getChildren().add(new Label(titles[i]);
}
FlowPane lays out each managed child regardless of the child's visible property value; unmanaged children are ignored for all layout calculations.
FlowPane may be styled with backgrounds and borders using CSS. See
Region
superclass for details.
horizontal:
width | height | |
---|---|---|
minimum | left/right insets plus largest of children's pref widths | top/bottom insets plus height required to display all children at their preferred heights when wrapped at a specified width |
preferred | left/right insets plus prefWrapLength | top/bottom insets plus height required to display all children at their pref heights when wrapped at a specified width |
maximum | Double.MAX_VALUE | Double.MAX_VALUE |
vertical:
width | height | |
---|---|---|
minimum | left/right insets plus width required to display all children at their preferred widths when wrapped at a specified height | top/bottom insets plus largest of children's pref heights |
preferred | left/right insets plus width required to display all children at their pref widths when wrapped at the specified height | top/bottom insets plus prefWrapLength |
maximum | Double.MAX_VALUE | Double.MAX_VALUE |
A flowpane'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.
FlowPane 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:
flowpane.setMaxWidth(500);
Applications may restore the computed values by setting these properties back
to Region.USE_COMPUTED_SIZE.
FlowPane does not clip its content by default, so it is possible that childrens' bounds may extend outside its own bounds if a child's pref size is larger than the space flowpane has to allocate for it.
Type | Property and Description |
---|---|
ObjectProperty<Pos> |
alignment
The overall alignment of the flowpane's content within its width and height.
|
ObjectProperty<HPos> |
columnHalignment
The horizontal alignment of nodes within each column of a vertical flowpane.
|
DoubleProperty |
hgap
The amount of horizontal space between each node in a horizontal flowpane
or the space between columns in a vertical flowpane.
|
ObjectProperty<Orientation> |
orientation
The orientation of this flowpane.
|
DoubleProperty |
prefWrapLength
The preferred width where content should wrap in a horizontal flowpane or
the preferred height where content should wrap in a vertical flowpane.
|
ObjectProperty<VPos> |
rowValignment
The vertical alignment of nodes within each row of a horizontal flowpane.
|
DoubleProperty |
vgap
The amount of vertical space between each node in a vertical flowpane
or the space between rows in a horizontal flowpane.
|
height, maxHeight, maxWidth, minHeight, minWidth, padding, prefHeight, prefWidth, snapToPixel, width
needsLayout
blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, 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, visible
USE_COMPUTED_SIZE, USE_PREF_SIZE
Constructor and Description |
---|
FlowPane()
Creates a horizontal FlowPane layout with hgap/vgap = 0.
|
FlowPane(double hgap,
double vgap)
Creates a horizontal FlowPane layout with the specified hgap/vgap.
|
FlowPane(Orientation orientation)
Creates a FlowPane layout with the specified orientation and hgap/vgap = 0.
|
FlowPane(Orientation orientation,
double hgap,
double vgap)
Creates a FlowPane layout with the specified orientation and hgap/vgap.
|
Modifier and Type | Method and Description |
---|---|
ObjectProperty<Pos> |
alignmentProperty()
The overall alignment of the flowpane's content within its width and height.
|
static void |
clearConstraints(Node child)
Removes all flowpane constraints from the child node.
|
ObjectProperty<HPos> |
columnHalignmentProperty()
The horizontal alignment of nodes within each column of a vertical flowpane.
|
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.
|
Pos |
getAlignment()
Gets the value of the property alignment.
|
HPos |
getColumnHalignment()
Gets the value of the property columnHalignment.
|
Orientation |
getContentBias()
Returns the orientation of a node's resizing bias for layout purposes.
|
double |
getHgap()
Gets the value of the property hgap.
|
static Insets |
getMargin(Node child)
Returns the child's margin constraint if set.
|
Orientation |
getOrientation()
Gets the value of the property orientation.
|
double |
getPrefWrapLength()
Gets the value of the property prefWrapLength.
|
VPos |
getRowValignment()
Gets the value of the property rowValignment.
|
double |
getVgap()
Gets the value of the property vgap.
|
DoubleProperty |
hgapProperty()
The amount of horizontal space between each node in a horizontal flowpane
or the space between columns in a vertical flowpane.
|
protected void |
layoutChildren()
Invoked during the layout pass to layout the children in this
Parent . |
ObjectProperty<Orientation> |
orientationProperty()
The orientation of this flowpane.
|
DoubleProperty |
prefWrapLengthProperty()
The preferred width where content should wrap in a horizontal flowpane or
the preferred height where content should wrap in a vertical flowpane.
|
void |
requestLayout()
Requests a layout pass to be performed before the next scene is
rendered.
|
ObjectProperty<VPos> |
rowValignmentProperty()
The vertical alignment of nodes within each row of a horizontal flowpane.
|
void |
setAlignment(Pos value)
Sets the value of the property alignment.
|
void |
setColumnHalignment(HPos value)
Sets the value of the property columnHalignment.
|
void |
setHgap(double value)
Sets the value of the property hgap.
|
static void |
setMargin(Node child,
Insets value)
Sets the margin for the child when contained by a flowpane.
|
void |
setOrientation(Orientation value)
Sets the value of the property orientation.
|
void |
setPrefWrapLength(double value)
Sets the value of the property prefWrapLength.
|
void |
setRowValignment(VPos value)
Sets the value of the property rowValignment.
|
void |
setVgap(double value)
Sets the value of the property vgap.
|
DoubleProperty |
vgapProperty()
The amount of vertical space between each node in a vertical flowpane
or the space between rows in a horizontal flowpane.
|
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, getStylesheets, 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, getLocalToParentTransform, getLocalToSceneTransform, 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, 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, localToParentTransformProperty, localToScene, localToScene, localToScene, localToSceneTransformProperty, lookupAll, managedProperty, mouseTransparentProperty, 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, 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, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, visibleProperty
public final ObjectProperty<Orientation> orientationProperty
getOrientation()
,
setOrientation(Orientation)
public final DoubleProperty hgapProperty
getHgap()
,
setHgap(double)
public final DoubleProperty vgapProperty
getVgap()
,
setVgap(double)
public final DoubleProperty prefWrapLengthProperty
This value is used only to compute the preferred size of the flowpane and may not reflect the actual width or height, which may change if the flowpane is resized to something other than its preferred size.
Applications should initialize this value to define a reasonable span for wrapping the content.
getPrefWrapLength()
,
setPrefWrapLength(double)
public final ObjectProperty<Pos> alignmentProperty
For a horizontal flowpane, each row will be aligned within the flowpane's width using the alignment's hpos value, and the rows will be aligned within the flowpane's height using the alignment's vpos value.
For a vertical flowpane, each column will be aligned within the flowpane's height using the alignment's vpos value, and the columns will be aligned within the flowpane's width using the alignment's hpos value.
getAlignment()
,
setAlignment(Pos)
public final ObjectProperty<HPos> columnHalignmentProperty
public final ObjectProperty<VPos> rowValignmentProperty
getRowValignment()
,
setRowValignment(VPos)
public FlowPane()
public FlowPane(Orientation orientation)
orientation
- the direction the tiles should flow & wrappublic FlowPane(double hgap, double vgap)
hgap
- the amount of horizontal space between each tilevgap
- the amount of vertical space between each tilepublic FlowPane(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 setMargin(Node child, Insets value)
child
- the child node of a flowpanevalue
- the margin of space around the childpublic static Insets getMargin(Node child)
child
- the child node of a flowpanepublic 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 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 DoubleProperty prefWrapLengthProperty()
This value is used only to compute the preferred size of the flowpane and may not reflect the actual width or height, which may change if the flowpane is resized to something other than its preferred size.
Applications should initialize this value to define a reasonable span for wrapping the content.
getPrefWrapLength()
,
setPrefWrapLength(double)
public final void setPrefWrapLength(double value)
This value is used only to compute the preferred size of the flowpane and may not reflect the actual width or height, which may change if the flowpane is resized to something other than its preferred size.
Applications should initialize this value to define a reasonable span for wrapping the content.
public final double getPrefWrapLength()
This value is used only to compute the preferred size of the flowpane and may not reflect the actual width or height, which may change if the flowpane is resized to something other than its preferred size.
Applications should initialize this value to define a reasonable span for wrapping the content.
public final ObjectProperty<Pos> alignmentProperty()
For a horizontal flowpane, each row will be aligned within the flowpane's width using the alignment's hpos value, and the rows will be aligned within the flowpane's height using the alignment's vpos value.
For a vertical flowpane, each column will be aligned within the flowpane's height using the alignment's vpos value, and the columns will be aligned within the flowpane's width using the alignment's hpos value.
getAlignment()
,
setAlignment(Pos)
public final void setAlignment(Pos value)
For a horizontal flowpane, each row will be aligned within the flowpane's width using the alignment's hpos value, and the rows will be aligned within the flowpane's height using the alignment's vpos value.
For a vertical flowpane, each column will be aligned within the flowpane's height using the alignment's vpos value, and the columns will be aligned within the flowpane's width using the alignment's hpos value.
public final Pos getAlignment()
For a horizontal flowpane, each row will be aligned within the flowpane's width using the alignment's hpos value, and the rows will be aligned within the flowpane's height using the alignment's vpos value.
For a vertical flowpane, each column will be aligned within the flowpane's height using the alignment's vpos value, and the columns will be aligned within the flowpane's width using the alignment's hpos value.
public final ObjectProperty<HPos> columnHalignmentProperty()
public final void setColumnHalignment(HPos value)
public final HPos getColumnHalignment()
public final ObjectProperty<VPos> rowValignmentProperty()
getRowValignment()
,
setRowValignment(VPos)
public final void setRowValignment(VPos value)
public final VPos getRowValignment()
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)
protected double computeMinWidth(double height)
Region
computeMinWidth
in class Region
height
- the height that should be used if min width depends
on itprotected double computeMinHeight(double width)
Region
computeMinHeight
in class Region
width
- the width that should be used if min height depends
on itprotected 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 itpublic 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 void layoutChildren()
Parent
Parent
. By default it will only set the size of managed,
resizable content to their preferred sizes and does not do any node
positioning.
Subclasses should override this function to layout content as needed.
layoutChildren
in class Parent
Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to