Class Region
- All Implemented Interfaces:
-
Styleable,EventTarget
- Direct Known Subclasses:
-
Axis,Chart,Control,Pane,TableColumnHeader,VirtualFlow
public class Region extends Parent
Every Region has its layout bounds, which are specified to be (0, 0, width, height). A Region might draw outside these bounds. The content area of a Region is the area which is occupied for the layout of its children. This area is, by default, the same as the layout bounds of the Region, but can be modified by either the properties of a border (either with BorderStrokes or BorderImages), and by padding. The padding can be negative, such that the content area of a Region might extend beyond the layout bounds of the Region, but does not affect the layout bounds.
A Region has a Background, and a Border, although either or both of these might be empty. The Background of a Region is made up of zero or more BackgroundFills, and zero or more BackgroundImages. Likewise, the border of a Region is defined by its Border, which is made up of zero or more BorderStrokes and zero or more BorderImages. All BackgroundFills are drawn first, followed by BackgroundImages, BorderStrokes, and finally BorderImages. The content is drawn above all backgrounds and borders. If a BorderImage is present (and loaded all images properly), then no BorderStrokes are actually drawn, although they are considered for computing the position of the content area (see the stroke width property of a BorderStroke). These semantics are in line with the CSS 3 specification. The purpose of these semantics are to allow an application to specify a fallback BorderStroke to be displayed in the case that an ImageStroke fails to download or load.
By default a Region appears as a Rectangle. A BackgroundFill radii might cause the Rectangle to appear rounded. This affects not only making the visuals look like a rounded rectangle, but it also causes the picking behavior of the Region to act like a rounded rectangle, such that locations outside the corner radii are ignored. A Region can be made to use any shape, however, by specifying the shape property. If a shape is specified, then all BackgroundFills, BackgroundImages, and BorderStrokes will be applied to the shape. BorderImages are not used for Regions which have a shape specified.
Although the layout bounds of a Region are not influenced by any Border or Background, the content area insets and the picking area of the Region are. The insets of the Region define the distance between the edge of the layout bounds and the edge of the content area. For example, if the Region layout bounds are (x=0, y=0, width=200, height=100), and the insets are (top=10, right=20, bottom=30, left=40), then the content area bounds will be (x=40, y=10, width=140, height=60). A Region subclass which is laying out its children should compute and honor these content area bounds.
By default a Region inherits the layout behavior of its superclass, Parent, which means that it will resize any resizable child nodes to their preferred size, but will not reposition them. If an application needs more specific layout behavior, then it should use one of the Region subclasses: StackPane, HBox, VBox, TilePane, FlowPane, BorderPane, GridPane, or AnchorPane.
To implement a more custom layout, a Region subclass must override computePrefWidth, computePrefHeight, and layoutChildren. Note that layoutChildren is called automatically by the scene graph while executing a top-down layout pass and it should not be invoked directly by the region subclass.
Region subclasses which layout their children will position nodes by setting layoutX/layoutY and do not alter translateX/translateY, which are reserved for adjustments and animation.
- Since:
- JavaFX 2.0
Property Summary
| Type | Property | Description |
|---|---|---|
final ObjectProperty |
background |
The background of the Region, which is made up of zero or more BackgroundFills, and zero or more BackgroundImages. |
final ObjectProperty |
border |
The border of the Region, which is made up of zero or more BorderStrokes, and zero or more BorderImages. |
final BooleanProperty |
cacheShape |
Defines a hint to the system indicating that the Shape used to define the region's background is stable and would benefit from caching. |
final BooleanProperty |
centerShape |
Defines whether the shape is centered within the Region's width and height. |
final ReadOnlyDoubleProperty |
height |
The height of this resizable node. |
final ReadOnlyObjectProperty |
insets |
The insets of the Region define the distance from the edge of the region (its layout bounds, or (0, 0, width, height)) to the edge of the content area. |
final DoubleProperty |
maxHeight |
Property for overriding the region's computed maximum height. |
final DoubleProperty |
maxWidth |
Property for overriding the region's computed maximum width. |
final DoubleProperty |
minHeight |
Property for overriding the region's computed minimum height. |
final DoubleProperty |
minWidth |
Property for overriding the region's computed minimum width. |
final ObjectProperty |
opaqueInsets |
Defines the area of the region within which completely opaque pixels are drawn. |
final ObjectProperty |
padding |
The top, right, bottom, and left padding around the region's content. |
final DoubleProperty |
prefHeight |
Property for overriding the region's computed preferred height. |
final DoubleProperty |
prefWidth |
Property for overriding the region's computed preferred width. |
final BooleanProperty |
scaleShape |
Specifies whether the shape, if defined, is scaled to match the size of the Region. |
final ObjectProperty |
shape |
When specified, the Shape will cause the region to be rendered as the specified shape rather than as a rounded rectangle. |
final BooleanProperty |
snapToPixel |
Defines whether this region adjusts position, spacing, and size values of its children to pixel boundaries. |
final ReadOnlyDoubleProperty |
width |
The width of this resizable node. |
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
| Modifier and Type | Field | Description |
|---|---|---|
static final double |
USE_COMPUTED_SIZE |
Sentinel value which can be passed to a region's setMinWidth, setMinHeight, setPrefWidth, setPrefHeight, setMaxWidth, setMaxHeight methods to reset the region's size constraint back to it's intrinsic size returned by computeMinWidth, computeMinHeight, computePrefWidth, computePrefHeight, computeMaxWidth, or computeMaxHeight. |
static final double |
USE_PREF_SIZE |
Sentinel value which can be passed to a region's setMinWidth, setMinHeight, setMaxWidth or setMaxHeight methods to indicate that the preferred dimension should be used for that max and/or min constraint. |
Fields declared in class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
Constructor Summary
| Constructor | Description |
|---|---|
Region() |
Creates a new Region with an empty Background and and empty Border. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
final ObjectProperty |
backgroundProperty() |
The background of the Region, which is made up of zero or more BackgroundFills, and zero or more BackgroundImages. |
final ObjectProperty |
borderProperty() |
The border of the Region, which is made up of zero or more BorderStrokes, and zero or more BorderImages. |
final BooleanProperty |
cacheShapeProperty() |
Defines a hint to the system indicating that the Shape used to define the region's background is stable and would benefit from caching. |
final BooleanProperty |
centerShapeProperty() |
Defines whether the shape is centered within the Region's width and height. |
protected double |
computeMaxHeight |
Computes the maximum height of this region. |
protected double |
computeMaxWidth |
Computes the maximum width for this region. |
protected double |
computeMinHeight |
Computes the minimum height of this region. |
protected double |
computeMinWidth |
Computes the minimum width of this region. |
protected double |
computePrefHeight |
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 |
Computes the preferred width of this region for the given height. |
final Background |
getBackground() |
Gets the value of the background property. |
final Border |
getBorder() |
Gets the value of the border property. |
static List |
getClassCssMetaData() |
Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses. |
List |
getCssMetaData() |
This method should delegate to Node.getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection. |
final double |
getHeight() |
Gets the value of the height property. |
final Insets |
getInsets() |
Gets the value of the insets property. |
final double |
getMaxHeight() |
Gets the value of the maxHeight property. |
final double |
getMaxWidth() |
Gets the value of the maxWidth property. |
final double |
getMinHeight() |
Gets the value of the minHeight property. |
final double |
getMinWidth() |
Gets the value of the minWidth property. |
final Insets |
getOpaqueInsets() |
Gets the value of the opaqueInsets property. |
final Insets |
getPadding() |
Gets the value of the padding property. |
final double |
getPrefHeight() |
Gets the value of the prefHeight property. |
final double |
getPrefWidth() |
Gets the value of the prefWidth property. |
final Shape |
getShape() |
Gets the value of the shape property. |
String |
getUserAgentStylesheet() |
An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. |
final double |
getWidth() |
Gets the value of the width property. |
final ReadOnlyDoubleProperty |
heightProperty() |
The height of this resizable node. |
final ReadOnlyObjectProperty |
insetsProperty() |
The insets of the Region define the distance from the edge of the region (its layout bounds, or (0, 0, width, height)) to the edge of the content area. |
final boolean |
isCacheShape() |
Gets the value of the cacheShape property. |
final boolean |
isCenterShape() |
Gets the value of the centerShape property. |
boolean |
isResizable() |
Returns true since all Regions are resizable. |
final boolean |
isScaleShape() |
Gets the value of the scaleShape property. |
final boolean |
isSnapToPixel() |
Gets the value of the snapToPixel property. |
protected void |
layoutInArea |
Utility method which lays out the child within an area of this region defined by areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. |
protected void |
layoutInArea |
Utility method which lays out the child within an area of this region defined by areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. |
static void |
layoutInArea |
Utility method which lays out the child within an area of it's parent defined by areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. |
protected void |
layoutInArea |
Utility method which lays out the child within an area of this region defined by areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. |
final double |
maxHeight |
Called during layout to determine the maximum height for this node. |
final DoubleProperty |
maxHeightProperty() |
Property for overriding the region's computed maximum height. |
final double |
maxWidth |
Called during layout to determine the maximum width for this node. |
final DoubleProperty |
maxWidthProperty() |
Property for overriding the region's computed maximum width. |
final double |
minHeight |
Called during layout to determine the minimum height for this node. |
final DoubleProperty |
minHeightProperty() |
Property for overriding the region's computed minimum height. |
final double |
minWidth |
Called during layout to determine the minimum width for this node. |
final DoubleProperty |
minWidthProperty() |
Property for overriding the region's computed minimum width. |
final ObjectProperty |
opaqueInsetsProperty() |
Defines the area of the region within which completely opaque pixels are drawn. |
final ObjectProperty |
paddingProperty() |
The top, right, bottom, and left padding around the region's content. |
protected void |
positionInArea |
Utility method which positions the child within an area of this region defined by areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. |
static void |
positionInArea |
Utility method which positions the child within an area of this region defined by areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. |
final double |
prefHeight |
Called during layout to determine the preferred height for this node. |
final DoubleProperty |
prefHeightProperty() |
Property for overriding the region's computed preferred height. |
final double |
prefWidth |
Called during layout to determine the preferred width for this node. |
final DoubleProperty |
prefWidthProperty() |
Property for overriding the region's computed preferred width. |
void |
resize |
Invoked by the region's parent during layout to set the region's width and height. |
final BooleanProperty |
scaleShapeProperty() |
Specifies whether the shape, if defined, is scaled to match the size of the Region. |
final void |
setBackground |
Sets the value of the background property. |
final void |
setBorder |
Sets the value of the border property. |
final void |
setCacheShape |
Sets the value of the cacheShape property. |
final void |
setCenterShape |
Sets the value of the centerShape property. |
protected void |
setHeight |
Sets the value of the height property. |
final void |
setMaxHeight |
Sets the value of the maxHeight property. |
void |
setMaxSize |
Convenience method for overriding the region's computed maximum width and height. |
final void |
setMaxWidth |
Sets the value of the maxWidth property. |
final void |
setMinHeight |
Sets the value of the minHeight property. |
void |
setMinSize |
Convenience method for overriding the region's computed minimum width and height. |
final void |
setMinWidth |
Sets the value of the minWidth property. |
final void |
setOpaqueInsets |
Sets the value of the opaqueInsets property. |
final void |
setPadding |
Sets the value of the padding property. |
final void |
setPrefHeight |
Sets the value of the prefHeight property. |
void |
setPrefSize |
Convenience method for overriding the region's computed preferred width and height. |
final void |
setPrefWidth |
Sets the value of the prefWidth property. |
final void |
setScaleShape |
Sets the value of the scaleShape property. |
final void |
setShape |
Sets the value of the shape property. |
final void |
setSnapToPixel |
Sets the value of the snapToPixel property. |
protected void |
setWidth |
Sets the value of the width property. |
final ObjectProperty |
shapeProperty() |
When specified, the Shape will cause the region to be rendered as the specified shape rather than as a rounded rectangle. |
final double |
snappedBottomInset() |
Utility method to get the bottom inset which includes padding and border inset. |
final double |
snappedLeftInset() |
Utility method to get the left inset which includes padding and border inset. |
final double |
snappedRightInset() |
Utility method to get the right inset which includes padding and border inset. |
final double |
snappedTopInset() |
Utility method to get the top inset which includes padding and border inset. |
protected double |
snapPosition |
Deprecated. |
double |
snapPositionX |
If this region's snapToPixel property is true, returns a value rounded to the nearest pixel in the horizontal direction, else returns the same value. |
double |
snapPositionY |
If this region's snapToPixel property is true, returns a value rounded to the nearest pixel in the vertical direction, else returns the same value. |
protected double |
snapSize |
Deprecated. replaced by snapSizeX() and snapSizeY()
|
double |
snapSizeX |
If this region's snapToPixel property is true, returns a value ceiled to the nearest pixel in the horizontal direction, else returns the same value. |
double |
snapSizeY |
If this region's snapToPixel property is true, returns a value ceiled to the nearest pixel in the vertical direction, else returns the same value. |
protected double |
snapSpace |
Deprecated. replaced by snapSpaceX() and snapSpaceY()
|
double |
snapSpaceX |
If this region's snapToPixel property is true, returns a value rounded to the nearest pixel in the horizontal direction, else returns the same value. |
double |
snapSpaceY |
If this region's snapToPixel property is true, returns a value rounded to the nearest pixel in the vertical direction, else returns the same value. |
final BooleanProperty |
snapToPixelProperty() |
Defines whether this region adjusts position, spacing, and size values of its children to pixel boundaries. |
final ReadOnlyDoubleProperty |
widthProperty() |
The width of this resizable node. |
Methods declared in class javafx.scene.Parent
getBaselineOffset, getChildren, 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
snapToPixel
public final BooleanProperty snapToPixelProperty
- See Also:
padding
public final ObjectProperty<Insets> paddingProperty
Insets.EMPTY. Setting the value to null should be avoided.- See Also:
background
public final ObjectProperty<Background> backgroundProperty
- Since:
- JavaFX 8.0
- See Also:
border
public final ObjectProperty<Border> borderProperty
- Since:
- JavaFX 8.0
- See Also:
opaqueInsets
public final ObjectProperty<Insets> opaqueInsetsProperty
- Since:
- JavaFX 8.0
- See Also:
insets
public final ReadOnlyObjectProperty<Insets> insetsProperty
- Since:
- JavaFX 8.0
- See Also:
width
public final ReadOnlyDoubleProperty widthProperty
minWidth, prefWidth, and maxWidth properties.- See Also:
height
public final ReadOnlyDoubleProperty heightProperty
minHeight, prefHeight, and maxHeight properties.- See Also:
minWidth
public final DoubleProperty minWidthProperty
Defaults to the USE_COMPUTED_SIZE flag, which means that minWidth(forHeight) will return the region's internally computed minimum width.
Setting this value to the USE_PREF_SIZE flag will cause minWidth(forHeight) to return the region's preferred width, enabling applications to easily restrict the resizability of the region.
- See Also:
minHeight
public final DoubleProperty minHeightProperty
Defaults to the USE_COMPUTED_SIZE flag, which means that minHeight(forWidth) will return the region's internally computed minimum height.
Setting this value to the USE_PREF_SIZE flag will cause minHeight(forWidth) to return the region's preferred height, enabling applications to easily restrict the resizability of the region.
- See Also:
prefWidth
public final DoubleProperty prefWidthProperty
Defaults to the USE_COMPUTED_SIZE flag, which means that prefWidth(forHeight) will return the region's internally computed preferred width.
- See Also:
prefHeight
public final DoubleProperty prefHeightProperty
Defaults to the USE_COMPUTED_SIZE flag, which means that prefHeight(forWidth) will return the region's internally computed preferred width.
- See Also:
maxWidth
public final DoubleProperty maxWidthProperty
Defaults to the USE_COMPUTED_SIZE flag, which means that maxWidth(forHeight) will return the region's internally computed maximum width.
Setting this value to the USE_PREF_SIZE flag will cause maxWidth(forHeight) to return the region's preferred width, enabling applications to easily restrict the resizability of the region.
- See Also:
maxHeight
public final DoubleProperty maxHeightProperty
Defaults to the USE_COMPUTED_SIZE flag, which means that maxHeight(forWidth) will return the region's internally computed maximum height.
Setting this value to the USE_PREF_SIZE flag will cause maxHeight(forWidth) to return the region's preferred height, enabling applications to easily restrict the resizability of the region.
- See Also:
shape
public final ObjectProperty<Shape> shapeProperty
Shape will cause the region to be rendered as the specified shape rather than as a rounded rectangle. When null, the Region is rendered as a rounded rectangle. When rendered as a Shape, any Background is used to fill the shape, although any background insets are ignored as are background radii. Any BorderStrokes defined are used for stroking the shape. Any BorderImages are ignored.- Default value:
- null
- Since:
- JavaFX 8.0
- See Also:
scaleShape
public final BooleanProperty scaleShapeProperty
true means the shape is scaled to fit the size of the Region, false means the shape is at its source size, its positioning depends on the value of centerShape.- Default value:
- true
- Since:
- JavaFX 8.0
- See Also:
centerShape
public final BooleanProperty centerShapeProperty
Region's width and height. When true, the shape is centered within the Region's width and height, otherwise the shape is positioned at its source position.- Default value:
- true
- Since:
- JavaFX 8.0
- See Also:
cacheShape
public final BooleanProperty cacheShapeProperty
- Default value:
- true
- Since:
- JavaFX 8.0
- See Also:
Field Details
USE_PREF_SIZE
public static final double USE_PREF_SIZE
setMinWidth, setMinHeight, setMaxWidth or setMaxHeight methods to indicate that the preferred dimension should be used for that max and/or min constraint.- See Also:
USE_COMPUTED_SIZE
public static final double USE_COMPUTED_SIZE
setMinWidth, setMinHeight, setPrefWidth, setPrefHeight, setMaxWidth, setMaxHeight methods to reset the region's size constraint back to it's intrinsic size returned by computeMinWidth, computeMinHeight, computePrefWidth, computePrefHeight, computeMaxWidth, or computeMaxHeight.- See Also:
Constructor Details
Region
public Region()
Method Details
isSnapToPixel
public final boolean isSnapToPixel()
snapToPixel property.- Property description:
- Defines whether this region adjusts position, spacing, and size values of its children to pixel boundaries. This defaults to true, which is generally the expected behavior in order to have crisp user interfaces. A value of false will allow for fractional alignment, which may lead to "fuzzy" looking borders.
- Returns:
- the value of the
snapToPixelproperty - See Also:
setSnapToPixel
public final void setSnapToPixel(boolean value)
snapToPixel property.- Property description:
- Defines whether this region adjusts position, spacing, and size values of its children to pixel boundaries. This defaults to true, which is generally the expected behavior in order to have crisp user interfaces. A value of false will allow for fractional alignment, which may lead to "fuzzy" looking borders.
- Parameters:
-
value- the value for thesnapToPixelproperty - See Also:
snapToPixelProperty
public final BooleanProperty snapToPixelProperty()
- Returns:
- the
snapToPixelproperty - See Also:
setPadding
public final void setPadding(Insets value)
padding property.- Property description:
- The top, right, bottom, and left padding around the region's content. This space will be included in the calculation of the region's minimum and preferred sizes. By default, padding is
Insets.EMPTY. Setting the value tonullshould be avoided. - Parameters:
-
value- the value for thepaddingproperty - See Also:
getPadding
public final Insets getPadding()
padding property.- Property description:
- The top, right, bottom, and left padding around the region's content. This space will be included in the calculation of the region's minimum and preferred sizes. By default, padding is
Insets.EMPTY. Setting the value tonullshould be avoided. - Returns:
- the value of the
paddingproperty - See Also:
paddingProperty
public final ObjectProperty<Insets> paddingProperty()
Insets.EMPTY. Setting the value to null should be avoided.- Returns:
- the
paddingproperty - See Also:
setBackground
public final void setBackground(Background value)
background property.- Property description:
- The background of the Region, which is made up of zero or more BackgroundFills, and zero or more BackgroundImages. It is possible for a Background to be empty, where it has neither fills nor images, and is semantically equivalent to null.
- Parameters:
-
value- the value for thebackgroundproperty - Since:
- JavaFX 8.0
- See Also:
getBackground
public final Background getBackground()
background property.- Property description:
- The background of the Region, which is made up of zero or more BackgroundFills, and zero or more BackgroundImages. It is possible for a Background to be empty, where it has neither fills nor images, and is semantically equivalent to null.
- Returns:
- the value of the
backgroundproperty - Since:
- JavaFX 8.0
- See Also:
backgroundProperty
public final ObjectProperty<Background> backgroundProperty()
- Returns:
- the
backgroundproperty - Since:
- JavaFX 8.0
- See Also:
setBorder
public final void setBorder(Border value)
border property.- Property description:
- The border of the Region, which is made up of zero or more BorderStrokes, and zero or more BorderImages. It is possible for a Border to be empty, where it has neither strokes nor images, and is semantically equivalent to null.
- Parameters:
-
value- the value for theborderproperty - Since:
- JavaFX 8.0
- See Also:
getBorder
public final Border getBorder()
border property.- Property description:
- The border of the Region, which is made up of zero or more BorderStrokes, and zero or more BorderImages. It is possible for a Border to be empty, where it has neither strokes nor images, and is semantically equivalent to null.
- Returns:
- the value of the
borderproperty - Since:
- JavaFX 8.0
- See Also:
borderProperty
public final ObjectProperty<Border> borderProperty()
- Returns:
- the
borderproperty - Since:
- JavaFX 8.0
- See Also:
opaqueInsetsProperty
public final ObjectProperty<Insets> opaqueInsetsProperty()
- Returns:
- the opaque insets property
- Since:
- JavaFX 8.0
- See Also:
setOpaqueInsets
public final void setOpaqueInsets(Insets value)
opaqueInsets property.- Property description:
- Defines the area of the region within which completely opaque pixels are drawn. This is used for various performance optimizations. The pixels within this area MUST BE fully opaque, or rendering artifacts will result. It is the responsibility of the application, either via code or via CSS, to ensure that the opaqueInsets is correct for a Region based on the backgrounds and borders of that region. The values for each of the insets must be real numbers, not NaN or Infinity. If no known insets exist, then the opaqueInsets should be set to null.
- Parameters:
-
value- the value for theopaqueInsetsproperty - Since:
- JavaFX 8.0
- See Also:
getOpaqueInsets
public final Insets getOpaqueInsets()
opaqueInsets property.- Property description:
- Defines the area of the region within which completely opaque pixels are drawn. This is used for various performance optimizations. The pixels within this area MUST BE fully opaque, or rendering artifacts will result. It is the responsibility of the application, either via code or via CSS, to ensure that the opaqueInsets is correct for a Region based on the backgrounds and borders of that region. The values for each of the insets must be real numbers, not NaN or Infinity. If no known insets exist, then the opaqueInsets should be set to null.
- Returns:
- the value of the
opaqueInsetsproperty - Since:
- JavaFX 8.0
- See Also:
getInsets
public final Insets getInsets()
insets property.- Property description:
- The insets of the Region define the distance from the edge of the region (its layout bounds, or (0, 0, width, height)) to the edge of the content area. All child nodes should be laid out within the content area. The insets are computed based on the Border which has been specified, if any, and also the padding.
- Returns:
- the value of the
insetsproperty - Since:
- JavaFX 8.0
- See Also:
insetsProperty
public final ReadOnlyObjectProperty<Insets> insetsProperty()
- Returns:
- the
insetsproperty - Since:
- JavaFX 8.0
- See Also:
setWidth
protected void setWidth(double value)
width property.- Property description:
- The width of this resizable node. This property is set by the region's parent during layout and may not be set by the application. If an application needs to explicitly control the size of a region, it should override its preferred size range by setting the
minWidth,prefWidth, andmaxWidthproperties. - Parameters:
-
value- the value for thewidthproperty - See Also:
getWidth
public final double getWidth()
width property.- Property description:
- The width of this resizable node. This property is set by the region's parent during layout and may not be set by the application. If an application needs to explicitly control the size of a region, it should override its preferred size range by setting the
minWidth,prefWidth, andmaxWidthproperties. - Returns:
- the value of the
widthproperty - See Also:
widthProperty
public final ReadOnlyDoubleProperty widthProperty()
minWidth, prefWidth, and maxWidth properties.- Returns:
- the
widthproperty - See Also:
setHeight
protected void setHeight(double value)
height property.- Property description:
- The height of this resizable node. This property is set by the region's parent during layout and may not be set by the application. If an application needs to explicitly control the size of a region, it should override its preferred size range by setting the
minHeight,prefHeight, andmaxHeightproperties. - Parameters:
-
value- the value for theheightproperty - See Also:
getHeight
public final double getHeight()
height property.- Property description:
- The height of this resizable node. This property is set by the region's parent during layout and may not be set by the application. If an application needs to explicitly control the size of a region, it should override its preferred size range by setting the
minHeight,prefHeight, andmaxHeightproperties. - Returns:
- the value of the
heightproperty - See Also:
heightProperty
public final ReadOnlyDoubleProperty heightProperty()
minHeight, prefHeight, and maxHeight properties.- Returns:
- the
heightproperty - See Also:
setMinWidth
public final void setMinWidth(double value)
minWidth property.- Property description:
- Property for overriding the region's computed minimum width. This should only be set if the region's internally computed minimum width doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatminWidth(forHeight)will return the region's internally computed minimum width.Setting this value to the
USE_PREF_SIZEflag will causeminWidth(forHeight)to return the region's preferred width, enabling applications to easily restrict the resizability of the region. - Parameters:
-
value- the value for theminWidthproperty - See Also:
getMinWidth
public final double getMinWidth()
minWidth property.- Property description:
- Property for overriding the region's computed minimum width. This should only be set if the region's internally computed minimum width doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatminWidth(forHeight)will return the region's internally computed minimum width.Setting this value to the
USE_PREF_SIZEflag will causeminWidth(forHeight)to return the region's preferred width, enabling applications to easily restrict the resizability of the region. - Returns:
- the value of the
minWidthproperty - See Also:
minWidthProperty
public final DoubleProperty minWidthProperty()
Defaults to the USE_COMPUTED_SIZE flag, which means that minWidth(forHeight) will return the region's internally computed minimum width.
Setting this value to the USE_PREF_SIZE flag will cause minWidth(forHeight) to return the region's preferred width, enabling applications to easily restrict the resizability of the region.
- Returns:
- the
minWidthproperty - See Also:
setMinHeight
public final void setMinHeight(double value)
minHeight property.- Property description:
- Property for overriding the region's computed minimum height. This should only be set if the region's internally computed minimum height doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatminHeight(forWidth)will return the region's internally computed minimum height.Setting this value to the
USE_PREF_SIZEflag will causeminHeight(forWidth)to return the region's preferred height, enabling applications to easily restrict the resizability of the region. - Parameters:
-
value- the value for theminHeightproperty - See Also:
getMinHeight
public final double getMinHeight()
minHeight property.- Property description:
- Property for overriding the region's computed minimum height. This should only be set if the region's internally computed minimum height doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatminHeight(forWidth)will return the region's internally computed minimum height.Setting this value to the
USE_PREF_SIZEflag will causeminHeight(forWidth)to return the region's preferred height, enabling applications to easily restrict the resizability of the region. - Returns:
- the value of the
minHeightproperty - See Also:
minHeightProperty
public final DoubleProperty minHeightProperty()
Defaults to the USE_COMPUTED_SIZE flag, which means that minHeight(forWidth) will return the region's internally computed minimum height.
Setting this value to the USE_PREF_SIZE flag will cause minHeight(forWidth) to return the region's preferred height, enabling applications to easily restrict the resizability of the region.
- Returns:
- the
minHeightproperty - See Also:
setMinSize
public void setMinSize(double minWidth, double minHeight)
- Parameters:
-
minWidth- the override value for minimum width -
minHeight- the override value for minimum height - See Also:
setPrefWidth
public final void setPrefWidth(double value)
prefWidth property.- Property description:
- Property for overriding the region's computed preferred width. This should only be set if the region's internally computed preferred width doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatprefWidth(forHeight)will return the region's internally computed preferred width. - Parameters:
-
value- the value for theprefWidthproperty - See Also:
getPrefWidth
public final double getPrefWidth()
prefWidth property.- Property description:
- Property for overriding the region's computed preferred width. This should only be set if the region's internally computed preferred width doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatprefWidth(forHeight)will return the region's internally computed preferred width. - Returns:
- the value of the
prefWidthproperty - See Also:
prefWidthProperty
public final DoubleProperty prefWidthProperty()
Defaults to the USE_COMPUTED_SIZE flag, which means that prefWidth(forHeight) will return the region's internally computed preferred width.
- Returns:
- the
prefWidthproperty - See Also:
setPrefHeight
public final void setPrefHeight(double value)
prefHeight property.- Property description:
- Property for overriding the region's computed preferred height. This should only be set if the region's internally computed preferred height doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatprefHeight(forWidth)will return the region's internally computed preferred width. - Parameters:
-
value- the value for theprefHeightproperty - See Also:
getPrefHeight
public final double getPrefHeight()
prefHeight property.- Property description:
- Property for overriding the region's computed preferred height. This should only be set if the region's internally computed preferred height doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatprefHeight(forWidth)will return the region's internally computed preferred width. - Returns:
- the value of the
prefHeightproperty - See Also:
prefHeightProperty
public final DoubleProperty prefHeightProperty()
Defaults to the USE_COMPUTED_SIZE flag, which means that prefHeight(forWidth) will return the region's internally computed preferred width.
- Returns:
- the
prefHeightproperty - See Also:
setPrefSize
public void setPrefSize(double prefWidth, double prefHeight)
- Parameters:
-
prefWidth- the override value for preferred width -
prefHeight- the override value for preferred height - See Also:
setMaxWidth
public final void setMaxWidth(double value)
maxWidth property.- Property description:
- Property for overriding the region's computed maximum width. This should only be set if the region's internally computed maximum width doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatmaxWidth(forHeight)will return the region's internally computed maximum width.Setting this value to the
USE_PREF_SIZEflag will causemaxWidth(forHeight)to return the region's preferred width, enabling applications to easily restrict the resizability of the region. - Parameters:
-
value- the value for themaxWidthproperty - See Also:
getMaxWidth
public final double getMaxWidth()
maxWidth property.- Property description:
- Property for overriding the region's computed maximum width. This should only be set if the region's internally computed maximum width doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatmaxWidth(forHeight)will return the region's internally computed maximum width.Setting this value to the
USE_PREF_SIZEflag will causemaxWidth(forHeight)to return the region's preferred width, enabling applications to easily restrict the resizability of the region. - Returns:
- the value of the
maxWidthproperty - See Also:
maxWidthProperty
public final DoubleProperty maxWidthProperty()
Defaults to the USE_COMPUTED_SIZE flag, which means that maxWidth(forHeight) will return the region's internally computed maximum width.
Setting this value to the USE_PREF_SIZE flag will cause maxWidth(forHeight) to return the region's preferred width, enabling applications to easily restrict the resizability of the region.
- Returns:
- the
maxWidthproperty - See Also:
setMaxHeight
public final void setMaxHeight(double value)
maxHeight property.- Property description:
- Property for overriding the region's computed maximum height. This should only be set if the region's internally computed maximum height doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatmaxHeight(forWidth)will return the region's internally computed maximum height.Setting this value to the
USE_PREF_SIZEflag will causemaxHeight(forWidth)to return the region's preferred height, enabling applications to easily restrict the resizability of the region. - Parameters:
-
value- the value for themaxHeightproperty - See Also:
getMaxHeight
public final double getMaxHeight()
maxHeight property.- Property description:
- Property for overriding the region's computed maximum height. This should only be set if the region's internally computed maximum height doesn't meet the application's layout needs.
Defaults to the
USE_COMPUTED_SIZEflag, which means thatmaxHeight(forWidth)will return the region's internally computed maximum height.Setting this value to the
USE_PREF_SIZEflag will causemaxHeight(forWidth)to return the region's preferred height, enabling applications to easily restrict the resizability of the region. - Returns:
- the value of the
maxHeightproperty - See Also:
maxHeightProperty
public final DoubleProperty maxHeightProperty()
Defaults to the USE_COMPUTED_SIZE flag, which means that maxHeight(forWidth) will return the region's internally computed maximum height.
Setting this value to the USE_PREF_SIZE flag will cause maxHeight(forWidth) to return the region's preferred height, enabling applications to easily restrict the resizability of the region.
- Returns:
- the
maxHeightproperty - See Also:
setMaxSize
public void setMaxSize(double maxWidth, double maxHeight)
- Parameters:
-
maxWidth- the override value for maximum width -
maxHeight- the override value for maximum height - See Also:
getShape
public final Shape getShape()
shape property.- Property description:
- When specified, the
Shapewill cause the region to be rendered as the specified shape rather than as a rounded rectangle. When null, the Region is rendered as a rounded rectangle. When rendered as a Shape, any Background is used to fill the shape, although any background insets are ignored as are background radii. Any BorderStrokes defined are used for stroking the shape. Any BorderImages are ignored. - Default value:
- null
- Returns:
- the value of the
shapeproperty - Since:
- JavaFX 8.0
- See Also:
setShape
public final void setShape(Shape value)
shape property.- Property description:
- When specified, the
Shapewill cause the region to be rendered as the specified shape rather than as a rounded rectangle. When null, the Region is rendered as a rounded rectangle. When rendered as a Shape, any Background is used to fill the shape, although any background insets are ignored as are background radii. Any BorderStrokes defined are used for stroking the shape. Any BorderImages are ignored. - Default value:
- null
- Parameters:
-
value- the value for theshapeproperty - Since:
- JavaFX 8.0
- See Also:
shapeProperty
public final ObjectProperty<Shape> shapeProperty()
Shape will cause the region to be rendered as the specified shape rather than as a rounded rectangle. When null, the Region is rendered as a rounded rectangle. When rendered as a Shape, any Background is used to fill the shape, although any background insets are ignored as are background radii. Any BorderStrokes defined are used for stroking the shape. Any BorderImages are ignored.- Default value:
- null
- Returns:
- the
shapeproperty - Since:
- JavaFX 8.0
- See Also:
setScaleShape
public final void setScaleShape(boolean value)
scaleShape property.- Property description:
- Specifies whether the shape, if defined, is scaled to match the size of the Region.
truemeans the shape is scaled to fit the size of the Region,falsemeans the shape is at its source size, its positioning depends on the value ofcenterShape. - Default value:
- true
- Parameters:
-
value- the value for thescaleShapeproperty - Since:
- JavaFX 8.0
- See Also:
isScaleShape
public final boolean isScaleShape()
scaleShape property.- Property description:
- Specifies whether the shape, if defined, is scaled to match the size of the Region.
truemeans the shape is scaled to fit the size of the Region,falsemeans the shape is at its source size, its positioning depends on the value ofcenterShape. - Default value:
- true
- Returns:
- the value of the
scaleShapeproperty - Since:
- JavaFX 8.0
- See Also:
scaleShapeProperty
public final BooleanProperty scaleShapeProperty()
true means the shape is scaled to fit the size of the Region, false means the shape is at its source size, its positioning depends on the value of centerShape.- Default value:
- true
- Returns:
- the
scaleShapeproperty - Since:
- JavaFX 8.0
- See Also:
setCenterShape
public final void setCenterShape(boolean value)
centerShape property.- Property description:
- Defines whether the shape is centered within the
Region's width and height. Whentrue, the shape is centered within theRegion's width and height, otherwise the shape is positioned at its source position. - Default value:
- true
- Parameters:
-
value- the value for thecenterShapeproperty - Since:
- JavaFX 8.0
- See Also:
isCenterShape
public final boolean isCenterShape()
centerShape property.- Property description:
- Defines whether the shape is centered within the
Region's width and height. Whentrue, the shape is centered within theRegion's width and height, otherwise the shape is positioned at its source position. - Default value:
- true
- Returns:
- the value of the
centerShapeproperty - Since:
- JavaFX 8.0
- See Also:
centerShapeProperty
public final BooleanProperty centerShapeProperty()
Region's width and height. When true, the shape is centered within the Region's width and height, otherwise the shape is positioned at its source position.- Default value:
- true
- Returns:
- the
centerShapeproperty - Since:
- JavaFX 8.0
- See Also:
setCacheShape
public final void setCacheShape(boolean value)
cacheShape property.- Property description:
- Defines a hint to the system indicating that the Shape used to define the region's background is stable and would benefit from caching.
- Default value:
- true
- Parameters:
-
value- the value for thecacheShapeproperty - Since:
- JavaFX 8.0
- See Also:
isCacheShape
public final boolean isCacheShape()
cacheShape property.- Property description:
- Defines a hint to the system indicating that the Shape used to define the region's background is stable and would benefit from caching.
- Default value:
- true
- Returns:
- the value of the
cacheShapeproperty - Since:
- JavaFX 8.0
- See Also:
cacheShapeProperty
public final BooleanProperty cacheShapeProperty()
- Default value:
- true
- Returns:
- the
cacheShapeproperty - Since:
- JavaFX 8.0
- See Also:
isResizable
public boolean isResizable()
true since all Regions are resizable.- Overrides:
-
isResizablein classNode - Returns:
- whether this node can be resized by its parent during layout
- See Also:
resize
public void resize(double width, double height)
setMinSize(), setPrefSize(), or setMaxSize() and it's parent will honor those overrides during layout.minWidth
public final double minWidth(double height)
computeMinWidth(forHeight) unless the application overrode the minimum width by setting the minWidth property.minHeight
public final double minHeight(double width)
computeMinHeight(forWidth) unless the application overrode the minimum height by setting the minHeight property.prefWidth
public final double prefWidth(double height)
computePrefWidth(forHeight) unless the application overrode the preferred width by setting the prefWidth property.prefHeight
public final double prefHeight(double width)
computePrefHeight(forWidth) unless the application overrode the preferred height by setting the prefHeight property.- Overrides:
-
prefHeightin classNode - Parameters:
-
width- the width that should be used if preferred height depends on it - Returns:
- the preferred height that this node should be resized to during layout
- See Also:
maxWidth
public final double maxWidth(double height)
computeMaxWidth(forHeight) unless the application overrode the maximum width by setting the maxWidth property.maxHeight
public final double maxHeight(double width)
computeMaxHeight(forWidth) unless the application overrode the maximum height by setting the maxHeight property.computeMinWidth
protected double computeMinWidth(double height)
- Overrides:
-
computeMinWidthin classParent - Parameters:
-
height- the height that should be used if min width depends on it - Returns:
- the computed minimum width of this region
computeMinHeight
protected double computeMinHeight(double width)
- Overrides:
-
computeMinHeightin classParent - Parameters:
-
width- the width that should be used if min height depends on it - Returns:
- the computed minimum height for this region
computePrefWidth
protected double computePrefWidth(double height)
- Overrides:
-
computePrefWidthin classParent - Parameters:
-
height- the height that should be used if preferred width depends on it - Returns:
- the computed preferred width for this region
computePrefHeight
protected double computePrefHeight(double width)
- Overrides:
-
computePrefHeightin classParent - Parameters:
-
width- the width that should be used if preferred height depends on it - Returns:
- the computed preferred height for this region
computeMaxWidth
protected double computeMaxWidth(double height)
- Parameters:
-
height- The height of the Region, in case this value might dictate the maximum width - Returns:
- the computed maximum width for this region
computeMaxHeight
protected double computeMaxHeight(double width)
- Parameters:
-
width- The width of the Region, in case this value might dictate the maximum height - Returns:
- the computed maximum height for this region
snapSpace
@Deprecated(since="9") protected double snapSpace(double value)
snapSpaceX() and snapSpaceY()
- Parameters:
-
value- the space value to be snapped - Returns:
- value rounded to nearest pixel
snapSpaceX
public double snapSpaceX(double value)
- Parameters:
-
value- the space value to be snapped - Returns:
- value rounded to nearest pixel
- Since:
- 9
snapSpaceY
public double snapSpaceY(double value)
- Parameters:
-
value- the space value to be snapped - Returns:
- value rounded to nearest pixel
- Since:
- 9
snapSize
@Deprecated(since="9") protected double snapSize(double value)
snapSizeX() and snapSizeY()
- Parameters:
-
value- the size value to be snapped - Returns:
- value ceiled to nearest pixel
snapSizeX
public double snapSizeX(double value)
- Parameters:
-
value- the size value to be snapped - Returns:
- value ceiled to nearest pixel
- Since:
- 9
snapSizeY
public double snapSizeY(double value)
- Parameters:
-
value- the size value to be snapped - Returns:
- value ceiled to nearest pixel
- Since:
- 9
snapPosition
@Deprecated(since="9") protected double snapPosition(double value)
snapPositionX() and snapPositionY()
- Parameters:
-
value- the position value to be snapped - Returns:
- value rounded to nearest pixel
snapPositionX
public double snapPositionX(double value)
- Parameters:
-
value- the position value to be snapped - Returns:
- value rounded to nearest pixel
- Since:
- 9
snapPositionY
public double snapPositionY(double value)
- Parameters:
-
value- the position value to be snapped - Returns:
- value rounded to nearest pixel
- Since:
- 9
snappedTopInset
public final double snappedTopInset()
- Returns:
- Rounded up insets top
- Since:
- JavaFX 8.0
snappedBottomInset
public final double snappedBottomInset()
- Returns:
- Rounded up insets bottom
- Since:
- JavaFX 8.0
snappedLeftInset
public final double snappedLeftInset()
- Returns:
- Rounded up insets left
- Since:
- JavaFX 8.0
snappedRightInset
public final double snappedRightInset()
- Returns:
- Rounded up insets right
- Since:
- JavaFX 8.0
positionInArea
protected void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, HPos halignment, VPos valignment)
areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. This function does not resize the node and uses the node's layout bounds width and height to determine how it should be positioned within the area.
If the vertical alignment is VPos.BASELINE then it will position the node so that its own baseline aligns with the passed in baselineOffset, otherwise the baseline parameter is ignored.
If snapToPixel is true for this region, then the x/y position values will be rounded to their nearest pixel boundaries.
- Parameters:
-
child- the child being positioned within this region -
areaX- the horizontal offset of the layout area relative to this region -
areaY- the vertical offset of the layout area relative to this region -
areaWidth- the width of the layout area -
areaHeight- the height of the layout area -
areaBaselineOffset- the baseline offset to be used if VPos is BASELINE -
halignment- the horizontal alignment for the child within the area -
valignment- the vertical alignment for the child within the area
positionInArea
public static void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, HPos halignment, VPos valignment, boolean isSnapToPixel)
areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. This function does not resize the node and uses the node's layout bounds width and height to determine how it should be positioned within the area.
If the vertical alignment is VPos.BASELINE then it will position the node so that its own baseline aligns with the passed in baselineOffset, otherwise the baseline parameter is ignored.
If snapToPixel is true for this region, then the x/y position values will be rounded to their nearest pixel boundaries.
If margin is non-null, then that space will be allocated around the child within the layout area. margin may be null.
- Parameters:
-
child- the child being positioned within this region -
areaX- the horizontal offset of the layout area relative to this region -
areaY- the vertical offset of the layout area relative to this region -
areaWidth- the width of the layout area -
areaHeight- the height of the layout area -
areaBaselineOffset- the baseline offset to be used if VPos is BASELINE -
margin- the margin of space to be allocated around the child -
halignment- the horizontal alignment for the child within the area -
valignment- the vertical alignment for the child within the area -
isSnapToPixel- whether to snap size and position to pixels - Since:
- JavaFX 8.0
layoutInArea
protected void layoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, HPos halignment, VPos valignment)
areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. If the child is resizable, this method will resize it to fill the specified area unless the node's maximum size prevents it. If the node's maximum size preference is less than the area size, the maximum size will be used. If node's maximum is greater than the area size, then the node will be resized to fit within the area, unless its minimum size prevents it.
If the child has a non-null contentBias, then this method will use it when resizing the child. If the contentBias is horizontal, it will set its width first to the area's width (up to the child's max width limit) and then pass that value to compute the child's height. If child's contentBias is vertical, then it will set its height to the area height (up to child's max height limit) and pass that height to compute the child's width. If the child's contentBias is null, then it's width and height have no dependencies on each other.
If the child is not resizable (Shape, Group, etc) then it will only be positioned and not resized.
If the child's resulting size differs from the area's size (either because it was not resizable or it's sizing preferences prevented it), then this function will align the node relative to the area using horizontal and vertical alignment values. If valignment is VPos.BASELINE then the node's baseline will be aligned with the area baseline offset parameter, otherwise the baseline parameter is ignored.
If snapToPixel is true for this region, then the resulting x,y values will be rounded to their nearest pixel boundaries and the width/height values will be ceiled to the next pixel boundary.
- Parameters:
-
child- the child being positioned within this region -
areaX- the horizontal offset of the layout area relative to this region -
areaY- the vertical offset of the layout area relative to this region -
areaWidth- the width of the layout area -
areaHeight- the height of the layout area -
areaBaselineOffset- the baseline offset to be used if VPos is BASELINE -
halignment- the horizontal alignment for the child within the area -
valignment- the vertical alignment for the child within the area
layoutInArea
protected void layoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, HPos halignment, VPos valignment)
areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. If the child is resizable, this method will resize it to fill the specified area unless the node's maximum size prevents it. If the node's maximum size preference is less than the area size, the maximum size will be used. If node's maximum is greater than the area size, then the node will be resized to fit within the area, unless its minimum size prevents it.
If the child has a non-null contentBias, then this method will use it when resizing the child. If the contentBias is horizontal, it will set its width first to the area's width (up to the child's max width limit) and then pass that value to compute the child's height. If child's contentBias is vertical, then it will set its height to the area height (up to child's max height limit) and pass that height to compute the child's width. If the child's contentBias is null, then it's width and height have no dependencies on each other.
If the child is not resizable (Shape, Group, etc) then it will only be positioned and not resized.
If the child's resulting size differs from the area's size (either because it was not resizable or it's sizing preferences prevented it), then this function will align the node relative to the area using horizontal and vertical alignment values. If valignment is VPos.BASELINE then the node's baseline will be aligned with the area baseline offset parameter, otherwise the baseline parameter is ignored.
If margin is non-null, then that space will be allocated around the child within the layout area. margin may be null.
If snapToPixel is true for this region, then the resulting x,y values will be rounded to their nearest pixel boundaries and the width/height values will be ceiled to the next pixel boundary.
- Parameters:
-
child- the child being positioned within this region -
areaX- the horizontal offset of the layout area relative to this region -
areaY- the vertical offset of the layout area relative to this region -
areaWidth- the width of the layout area -
areaHeight- the height of the layout area -
areaBaselineOffset- the baseline offset to be used if VPos is BASELINE -
margin- the margin of space to be allocated around the child -
halignment- the horizontal alignment for the child within the area -
valignment- the vertical alignment for the child within the area
layoutInArea
protected void layoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, boolean fillWidth, boolean fillHeight, HPos halignment, VPos valignment)
areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. If the child is resizable, this method will use fillWidth and fillHeight to determine whether to resize it to fill the area or keep the child at its preferred dimension. If fillWidth/fillHeight are true, then this method will only resize the child up to its max size limits. If the node's maximum size preference is less than the area size, the maximum size will be used. If node's maximum is greater than the area size, then the node will be resized to fit within the area, unless its minimum size prevents it.
If the child has a non-null contentBias, then this method will use it when resizing the child. If the contentBias is horizontal, it will set its width first and then pass that value to compute the child's height. If child's contentBias is vertical, then it will set its height first and pass that value to compute the child's width. If the child's contentBias is null, then it's width and height have no dependencies on each other.
If the child is not resizable (Shape, Group, etc) then it will only be positioned and not resized.
If the child's resulting size differs from the area's size (either because it was not resizable or it's sizing preferences prevented it), then this function will align the node relative to the area using horizontal and vertical alignment values. If valignment is VPos.BASELINE then the node's baseline will be aligned with the area baseline offset parameter, otherwise the baseline parameter is ignored.
If margin is non-null, then that space will be allocated around the child within the layout area. margin may be null.
If snapToPixel is true for this region, then the resulting x,y values will be rounded to their nearest pixel boundaries and the width/height values will be ceiled to the next pixel boundary.
- Parameters:
-
child- the child being positioned within this region -
areaX- the horizontal offset of the layout area relative to this region -
areaY- the vertical offset of the layout area relative to this region -
areaWidth- the width of the layout area -
areaHeight- the height of the layout area -
areaBaselineOffset- the baseline offset to be used if VPos is BASELINE -
margin- the margin of space to be allocated around the child -
fillWidth- whether or not the child should be resized to fill the area width or kept to its preferred width -
fillHeight- whether or not the child should e resized to fill the area height or kept to its preferred height -
halignment- the horizontal alignment for the child within the area -
valignment- the vertical alignment for the child within the area
layoutInArea
public static void layoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, boolean fillWidth, boolean fillHeight, HPos halignment, VPos valignment, boolean isSnapToPixel)
areaX, areaY, areaWidth x areaHeight, with a baseline offset relative to that area. If the child is resizable, this method will use fillWidth and fillHeight to determine whether to resize it to fill the area or keep the child at its preferred dimension. If fillWidth/fillHeight are true, then this method will only resize the child up to its max size limits. If the node's maximum size preference is less than the area size, the maximum size will be used. If node's maximum is greater than the area size, then the node will be resized to fit within the area, unless its minimum size prevents it.
If the child has a non-null contentBias, then this method will use it when resizing the child. If the contentBias is horizontal, it will set its width first and then pass that value to compute the child's height. If child's contentBias is vertical, then it will set its height first and pass that value to compute the child's width. If the child's contentBias is null, then it's width and height have no dependencies on each other.
If the child is not resizable (Shape, Group, etc) then it will only be positioned and not resized.
If the child's resulting size differs from the area's size (either because it was not resizable or it's sizing preferences prevented it), then this function will align the node relative to the area using horizontal and vertical alignment values. If valignment is VPos.BASELINE then the node's baseline will be aligned with the area baseline offset parameter, otherwise the baseline parameter is ignored.
If margin is non-null, then that space will be allocated around the child within the layout area. margin may be null.
If snapToPixel is true for this region, then the resulting x,y values will be rounded to their nearest pixel boundaries and the width/height values will be ceiled to the next pixel boundary.
- Parameters:
-
child- the child being positioned within this region -
areaX- the horizontal offset of the layout area relative to this region -
areaY- the vertical offset of the layout area relative to this region -
areaWidth- the width of the layout area -
areaHeight- the height of the layout area -
areaBaselineOffset- the baseline offset to be used if VPos is BASELINE -
margin- the margin of space to be allocated around the child -
fillWidth- whether or not the child should be resized to fill the area width or kept to its preferred width -
fillHeight- whether or not the child should e resized to fill the area height or kept to its preferred height -
halignment- the horizontal alignment for the child within the area -
valignment- the vertical alignment for the child within the area -
isSnapToPixel- whether to snap size and position to pixels - Since:
- JavaFX 8.0
getUserAgentStylesheet
public String getUserAgentStylesheet()
The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.
Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.
package com.example.javafx.app;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class MyApp extends Application {
@Override public void start(Stage stage) {
Scene scene = new Scene(new Group());
scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.- Returns:
- A string URL
- Since:
- JavaFX 8u40
getClassCssMetaData
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
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()
Node.getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.- Specified by:
-
getCssMetaDatain interfaceStyleable - Overrides:
-
getCssMetaDatain classNode - Returns:
- The CssMetaData associated with this node, which may include the CssMetaData of its superclasses.
- Since:
- JavaFX 8.0
© 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.
snapPositionX()andsnapPositionY()