APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javafx.scene.layout

public Class Region

extends Parent
Class Inheritance
Known Direct Subclasses
com.sun.glass.ui.HeaderButtonOverlay, com.sun.glass.ui.HeaderButtonOverlay.ButtonRegion, javafx.scene.layout.HeaderBar, javafx.scene.layout.Pane
Imports
javafx.beans.InvalidationListener, javafx.beans.property.BooleanProperty, .DoubleProperty, .ObjectProperty, .ReadOnlyDoubleProperty, .ReadOnlyDoubleWrapper, .ReadOnlyObjectProperty, .ReadOnlyObjectPropertyBase, javafx.css.CssMetaData, .Styleable, .StyleableBooleanProperty, .StyleableDoubleProperty, .StyleableObjectProperty, .StyleableProperty, javafx.geometry.BoundingBox, .Bounds, .HPos, .Insets, .Orientation, .VPos, javafx.scene.Node, .Parent, .Scene, javafx.scene.image.Image, javafx.scene.shape.Shape, .StrokeLineCap, .StrokeLineJoin, .StrokeType, javafx.util.Callback, java.util.ArrayList, .Collections, .Arrays, .List, java.util.function.Function, com.sun.javafx.util.Logging, .TempState, javafx.css.converter.BooleanConverter, .InsetsConverter, .ShapeConverter, .SizeConverter, com.sun.javafx.geom.BaseBounds, .PickRay, .RectBounds, .Vec2d, com.sun.javafx.geom.transform.BaseTransform, com.sun.javafx.scene.DirtyBits, .NodeHelper, .ParentHelper, com.sun.javafx.scene.input.PickResultChooser, com.sun.javafx.scene.layout.RegionHelper, .ScaledMath, com.sun.javafx.scene.shape.ShapeHelper, com.sun.javafx.sg.prism.NGNode, .NGRegion, com.sun.javafx.tk.Toolkit, javafx.stage.Window, com.sun.javafx.logging.PlatformLogger, .PlatformLogger.Level

Region is the base class for all JavaFX Node-based UI Controls, and all layout containers. It is a resizable Parent node which can be styled from CSS. It can have multiple backgrounds and borders. It is designed to support as much of the CSS3 specification for backgrounds and borders as is relevant to JavaFX. The full specification is available at the W3C.

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class
Region.MinPrefMaxProperty

This class is reused for the min, pref, and max properties since they all performed the same function (to call requestParentLayout).

private class
Region.ShapeProperty

An implementation for the ShapeProperty.

private static class

Field Summary

Modifier and TypeField and Description
private double
_height

Because the height is very often set and very often read but only sometimes listened to, it is beneficial to use the super-lazy pattern property, where we only inflate the property object when heightProperty() is explicitly invoked.

private double
private double
private double
private double
private double
private double
private Shape
private boolean
_snapToPixel

I'm using a super-lazy property pattern here, so as to only create the property object when needed for listeners or when being set from CSS, but also making sure that we only call requestParentLayout in the case that the snapToPixel value has actually changed, whether set via the setter or set via the property object.

private double
_width

Because the width is very often set and very often read but only sometimes listened to, it is beneficial to use the super-lazy pattern property, where we only inflate the property object when widthProperty() is explicitly invoked.

private final ObjectProperty<Background>
background

The background of the Region, which is made up of zero or more BackgroundFills, and zero or more BackgroundImages.

private final ObjectProperty<Border>
border

The border of the Region, which is made up of zero or more BorderStrokes, and zero or more BorderImages.

private Bounds
private 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.

private BooleanProperty
centerShape

Defines whether the shape is centered within the Region's width and height.

private boolean
private ReadOnlyDoubleWrapper
height

The height of this resizable node.

private InvalidationListener
imageChangeListener

At the time that a Background or Border is set on a Region, we inspect any BackgroundImage or BorderImage objects, to see if the Image backing them is background loading and not yet complete, or is animated.

private final Region.InsetsProperty
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.

private double
private double
lastUsedSnapScaleY

Cached snapScale values, used to determine if snapped cached insets values should be invalidated because screen scale has changed.

private DoubleProperty
maxHeight

Property for overriding the region's computed maximum height.

private DoubleProperty
maxWidth

Property for overriding the region's computed maximum width.

private DoubleProperty
minHeight

Property for overriding the region's computed minimum height.

private DoubleProperty
minWidth

Property for overriding the region's computed minimum width.

private List<CornerRadii>
private List<CornerRadii>
private ObjectProperty<Insets>
private ObjectProperty<Insets>
padding

The top, right, bottom, and left padding around the region's content.

private DoubleProperty
prefHeight

Property for overriding the region's computed preferred height.

private DoubleProperty
prefWidth

Property for overriding the region's computed preferred width.

private BooleanProperty
scaleShape

Specifies whether the shape, if defined, is scaled to match the size of the Region.

private ObjectProperty<Shape>
shape

When specified, the Shape will cause the region to be rendered as the specified shape rather than as a rounded rectangle.

private double
private double
private double
private double
snappedTopInset

cached results of snapped insets, this are used a lot during layout so makes sense to keep fast access cached copies here.

private BooleanProperty
snapToPixel

Defines whether this region adjusts position, spacing, and size values of its children to pixel boundaries.

pack-priv static Vec2d
public 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.

public 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.

private ReadOnlyDoubleWrapper
width

The width of this resizable node.

Constructor Summary

AccessConstructor and Description
public
Region()

Creates a new Region with an empty Background and and empty Border.

Method Summary

Modifier and TypeMethod and Description
private static double
private static double
pack-priv void
addImageListener(Image
a non-null image
image
)

Adds the imageChangeListener to this image.

pack-priv double
adjustHeightByMargin(double height, Insets margin)

pack-priv double
adjustWidthByMargin(double width, Insets margin)

public final ObjectProperty<Background>
public final ObjectProperty<Border>
pack-priv static Vec2d

Returns:

Vec2d object with width(x parameter) and height (y parameter)
boundedNodeSizeWithBias
(Node
the node
node
,
double
the width of the bounding area where the node is going to be placed
areaWidth
,
double
the height of the bounding area where the node is going to be placed
areaHeight
,
boolean
if Node should try to fill the area width
fillWidth
,
boolean
if Node should try to fill the area height
fillHeight
,
Vec2d
Vec2d object for the result or null if new one should be created
result
)

Returns the size of a Node that should be placed in an area of the specified size, bounded in it's min/max size, respecting bias.

pack-priv static double

Returns:

the size bounded by min, pref, and max.
boundedSize
(double
The minimum bound
min
,
double
The value to be clamped between the min and max
pref
,
double
the maximum bound
max
)

Hides javafx.scene.Node.boundedSize.

Computes the value based on the given min and max values.

public final BooleanProperty
public final BooleanProperty
private double
computeBoundedWidth(Node child, boolean fill, double contentWidth)

pack-priv double
computeChildMaxAreaHeight(Node child, double maxBaselineComplement, Insets margin, double availableWidth, boolean fillWidth)

pack-priv double
computeChildMaxAreaWidth(Node child, double baselineComplement, Insets margin, double availableHeight, boolean fillHeight)

pack-priv double
pack-priv double
computeChildMinAreaHeight(Node child, double minBaselineComplement, Insets margin, double availableWidth, boolean fillWidth)

pack-priv double
pack-priv double
computeChildMinAreaWidth(Node child, double baselineComplement, Insets margin, double availableHeight, boolean fillHeight)

pack-priv double
pack-priv double
computeChildPrefAreaHeight(Node child, double prefBaselineComplement, Insets margin, double availableWidth, boolean fillWidth)

pack-priv double
pack-priv double
computeChildPrefAreaWidth(Node child, double baselineComplement, Insets margin, double availableHeight, boolean fillHeight)

private double
computeContentWidth(Insets margin, double width)

private double
computedBoundedHeight(Node child, boolean fill, double contentHeight)

protected double

Returns:

the computed maximum height for this region
computeMaxHeight
(double
The width of the Region, in case this value might dictate the maximum height
width
)

Computes the maximum height of this region.

pack-priv double
computeMaxMinAreaHeight(List<Node> children, Callback<Node, Insets> margins, VPos valignment)

pack-priv double
computeMaxMinAreaHeight(List<Node> children, Callback<Node, Insets> margins, double width, boolean fillWidth, VPos valignment)

pack-priv double
computeMaxMinAreaHeight(List<Node> children, Callback<Node, Insets> childMargins, double[] childWidths, boolean fillWidth, VPos valignment)

pack-priv double
pack-priv double
computeMaxMinAreaWidth(List<Node> children, Callback<Node, Insets> margins, double height, boolean fillHeight)

pack-priv double
computeMaxMinAreaWidth(List<Node> children, Callback<Node, Insets> childMargins, double[] childHeights, boolean fillHeight)

pack-priv double
computeMaxPrefAreaHeight(List<Node> children, Callback<Node, Insets> margins, VPos valignment)

pack-priv double
computeMaxPrefAreaHeight(List<Node> children, Callback<Node, Insets> margins, double width, boolean fillWidth, VPos valignment)

pack-priv double
computeMaxPrefAreaHeight(List<Node> children, Callback<Node, Insets> childMargins, double[] childWidths, boolean fillWidth, VPos valignment)

pack-priv double
pack-priv double
computeMaxPrefAreaWidth(List<Node> children, Callback<Node, Insets> margins, double height, boolean fillHeight)

pack-priv double
computeMaxPrefAreaWidth(List<Node> children, Callback<Node, Insets> childMargins, double[] childHeights, boolean fillHeight)

protected double

Returns:

the computed maximum width for this region
computeMaxWidth
(double
The height of the Region, in case this value might dictate the maximum width
height
)

Computes the maximum width for this region.

protected double

Returns:

the computed minimum height for this region
computeMinHeight
(double width)

Overrides javafx.scene.Parent.computeMinHeight.

Computes the minimum height of this region.

protected double

Returns:

the computed minimum width of this region
computeMinWidth
(double height)

Overrides javafx.scene.Parent.computeMinWidth.

Computes the minimum width of this region.

protected double

Returns:

the computed preferred height for this region
computePrefHeight
(double width)

Overrides javafx.scene.Parent.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

Returns:

the computed preferred width for this region
computePrefWidth
(double height)

Overrides javafx.scene.Parent.computePrefWidth.

Computes the preferred width of this region for the given height.

private BaseBounds
pack-priv static double
computeXOffset(double width, double contentWidth, HPos hpos)

pack-priv static double
computeYOffset(double height, double contentHeight, VPos vpos)

private boolean

Returns:

True if (px, py) is within the stroke, taking into account insets and corner radii.
contains
(final double
The x position of the point to test
px
,
final double
The y position of the point to test
py
,
final double
The x1 position of the bounds to test
x1
,
final double
The y1 position of the bounds to test
y1
,
final double
The x2 position of the bounds to test
x2
,
final double
The y2 position of the bounds to test
y2
,
BorderWidths
The widths of the stroke on each side
widths
,
boolean
Whether the area is filled or is just stroked
filled
,
final Insets
The insets to apply to (x1,y1)-(x2,y2) to get the final bounds to test
insets
,
final CornerRadii
The corner radii to test with. Must not be null.
rad
)

Basically we will perform two contains tests.

private boolean

Returns:

True if (px, py) is within the bounds, taking into account insets and corner radii.
contains
(final double
The x position of the point to test
px
,
final double
The y position of the point to test
py
,
final double
The x1 position of the bounds to test
x1
,
final double
The y1 position of the bounds to test
y1
,
final double
The x2 position of the bounds to test
x2
,
final double
The y2 position of the bounds to test
y2
,
final Insets
The insets to apply to (x1,y1)-(x2,y2) to get the final bounds to test
insets
,
CornerRadii
The corner radii to test with. Must not be null.
rad
)

Determines whether the point (px, py) is contained within the the bounds (x1, y1)-(x2, y2), after taking into account the insets and the corner radii.

pack-priv static double[]
createDoubleArray(int length, double value)

private boolean
doComputeContains(double localX, double localY)

Hides javafx.scene.Parent.doComputeContains.

private BaseBounds
private Bounds
doComputeLayoutBounds()

Hides javafx.scene.Node.doComputeLayoutBounds.

The layout bounds of this region: 0, 0 width x height

private NGNode
private void
private void
doPickNodeLocal(PickRay pickRay, PickResultChooser result)

Hides javafx.scene.Parent.doPickNodeLocal.

Some skins relying on this Note: This method MUST only be called via its accessor method.

private void
pack-priv double
getAreaBaselineOffset(List<Node> children, Callback<Node, Insets> margins, Function<Integer, Double> positionToWidth, double areaHeight, boolean fillHeight)

pack-priv static double
getAreaBaselineOffset(List<Node> children, Callback<Node, Insets> margins, Function<Integer, Double> positionToWidth, double areaHeight, boolean fillHeight, boolean snapToPixel)

pack-priv double
getAreaBaselineOffset(List<Node> children, Callback<Node, Insets> margins, Function<Integer, Double> positionToWidth, double areaHeight, final boolean fillHeight, double minComplement)

pack-priv static double
getAreaBaselineOffset(List<Node> children, Callback<Node, Insets> margins, Function<Integer, Double> positionToWidth, double areaHeight, final boolean fillHeight, double minComplement, boolean snapToPixel)

pack-priv double
getAreaBaselineOffset(List<Node> children, Callback<Node, Insets> margins, Function<Integer, Double> positionToWidth, double areaHeight, Function<Integer, Boolean> fillHeight, double minComplement)

pack-priv static double
getAreaBaselineOffset(List<Node>
the children with baseline alignment
children
,
Callback<Node, Insets>
their margins (callback)
margins
,
Function<Integer, Double>
callback for children widths (can return -1 if no bias is used)
positionToWidth
,
double
height of the area to layout in
areaHeight
,
Function<Integer, Boolean>
callback to specify children that has fillHeight constraint
fillHeight
,
double
minimum complement
minComplement
,
boolean snapToPixel)

Returns the baseline offset of provided children, with respect to the minimum complement, computed by getMinBaselineComplement(java.util.List) from the same set of children.

public final Background
private static double
getBaselineComplement(List<Node> children, boolean min, boolean max)

public final Border
public static List<CssMetaData<? extends Styleable, ?>>

Returns:

the CssMetaData
getClassCssMetaData
()

Hides javafx.scene.Node.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public List<CssMetaData<? extends Styleable, ?>>
getCssMetaData()

Overrides javafx.scene.Node.getCssMetaData.

Implements javafx.css.Styleable.getCssMetaData.

This method should delegate to Node#getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.

public final double
public final Insets
private double
getMaxAreaHeight(List<Node> children, Callback<Node, Insets> childMargins, double[] childWidths, boolean fillWidth, boolean minimum, VPos valignment)

private double
getMaxAreaWidth(List<Node> children, Callback<Node, Insets> childMargins, double[] childHeights, boolean fillHeight, boolean minimum)

pack-priv static double
getMaxBaselineComplement(List<Node> children)

Return the maximal complement of baseline

public final double
public final double
pack-priv static double
getMinBaselineComplement(List<Node> children)

Return the minimum complement of baseline

public final double
public final double
private CornerRadii

Returns:

the normalized (non-percentage, non-overflowing) radii
getNormalizedFillCorner
(int
the index of the BackgroundFill whose radii will be normalized.
i
)

Returns the normalized absolute radii for the indicated BackgroundFill, taking the current size of the region into account to eliminate any percentage-based measurements and to scale the radii to prevent overflowing the width or height.

private CornerRadii

Returns:

the normalized (non-percentage, non-overflowing) radii
getNormalizedStrokeCorner
(int
the index of the BorderStroke whose radii will be normalized.
i
)

Returns the normalized absolute radii for the indicated BorderStroke, taking the current size of the region into account to eliminate any percentage-based measurements and to scale the radii to prevent overflowing the width or height.

public final Insets
public final Insets
pack-priv static double
getPrefBaselineComplement(List<Node> children)

Return the preferred complement of baseline

public final double
public final double
public final Shape
pack-priv static double
private double
pack-priv static double
private double
public String

Returns:

A string URL
getUserAgentStylesheet
()

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final double
private void
heightChanged(double value)

public final ReadOnlyDoubleProperty
public final ReadOnlyObjectProperty<Insets>
public final boolean
public final boolean
public boolean

Returns:

whether this node can be resized by its parent during layout
isResizable
()

Overrides javafx.scene.Node.isResizable.

Returns true since all Regions are resizable.

public final boolean
public final boolean
protected void
layoutInArea(Node
the child being positioned within this region
child
,
double
the horizontal offset of the layout area relative to this region
areaX
,
double
the vertical offset of the layout area relative to this region
areaY
,
double
the width of the layout area
areaWidth
,
double
the height of the layout area
areaHeight
,
double
the baseline offset to be used if VPos is BASELINE
areaBaselineOffset
,
HPos
the horizontal alignment for the child within the area
halignment
,
VPos
the vertical alignment for the child within the area
valignment
)

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(Node
the child being positioned within this region
child
,
double
the horizontal offset of the layout area relative to this region
areaX
,
double
the vertical offset of the layout area relative to this region
areaY
,
double
the width of the layout area
areaWidth
,
double
the height of the layout area
areaHeight
,
double
the baseline offset to be used if VPos is BASELINE
areaBaselineOffset
,
Insets
the margin of space to be allocated around the child
margin
,
HPos
the horizontal alignment for the child within the area
halignment
,
VPos
the vertical alignment for the child within the area
valignment
)

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(Node
the child being positioned within this region
child
,
double
the horizontal offset of the layout area relative to this region
areaX
,
double
the vertical offset of the layout area relative to this region
areaY
,
double
the width of the layout area
areaWidth
,
double
the height of the layout area
areaHeight
,
double
the baseline offset to be used if VPos is BASELINE
areaBaselineOffset
,
Insets
the margin of space to be allocated around the child
margin
,
boolean
whether or not the child should be resized to fill the area width or kept to its preferred width
fillWidth
,
boolean
whether or not the child should e resized to fill the area height or kept to its preferred height
fillHeight
,
HPos
the horizontal alignment for the child within the area
halignment
,
VPos
the vertical alignment for the child within the area
valignment
)

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.

public static void
layoutInArea(Node
the child being positioned within this region
child
,
double
the horizontal offset of the layout area relative to this region
areaX
,
double
the vertical offset of the layout area relative to this region
areaY
,
double
the width of the layout area
areaWidth
,
double
the height of the layout area
areaHeight
,
double
the baseline offset to be used if VPos is BASELINE
areaBaselineOffset
,
Insets
the margin of space to be allocated around the child
margin
,
boolean
whether or not the child should be resized to fill the area width or kept to its preferred width
fillWidth
,
boolean
whether or not the child should e resized to fill the area height or kept to its preferred height
fillHeight
,
HPos
the horizontal alignment for the child within the area
halignment
,
VPos
the vertical alignment for the child within the area
valignment
,
boolean
whether to snap size and position to pixels
isSnapToPixel
)

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.

public final double

Returns:

the maximum height that this node should be resized to during layout
maxHeight
(double width)

Overrides javafx.scene.Node.maxHeight.

Called during layout to determine the maximum height for this node.

public final DoubleProperty
public final double

Returns:

the maximum width that this node should be resized to during layout
maxWidth
(double height)

Overrides javafx.scene.Node.maxWidth.

Called during layout to determine the maximum width for this node.

public final DoubleProperty
public final double

Returns:

the minimum height that this node should be resized to during layout
minHeight
(double width)

Overrides javafx.scene.Parent.minHeight.

Called during layout to determine the minimum height for this node.

public final DoubleProperty
public final double

Returns:

the minimum width that this node should be resized to during layout
minWidth
(double height)

Overrides javafx.scene.Parent.minWidth.

Called during layout to determine the minimum width for this node.

public final DoubleProperty
private static CornerRadii

Returns:

Normalized radii.
normalize
(CornerRadii
The radii.
radii
,
Insets
The insets for the associated background or stroke.
insets
,
double
The width of the region before insets are applied.
width
,
double
The height of the region before insets are applied.
height
)

Return a version of the radii that is not percentage based and is scaled to fit the indicated inset rectangle without overflow.

public final ObjectProperty<Insets>

Returns:

the opaque insets property
opaqueInsetsProperty
()

Defines the area of the region within which completely opaque pixels are drawn.

public final ObjectProperty<Insets>
private static void
position(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, double topMargin, double rightMargin, double bottomMargin, double leftMargin, HPos hpos, VPos vpos, boolean isSnapToPixel)

protected void
positionInArea(Node
the child being positioned within this region
child
,
double
the horizontal offset of the layout area relative to this region
areaX
,
double
the vertical offset of the layout area relative to this region
areaY
,
double
the width of the layout area
areaWidth
,
double
the height of the layout area
areaHeight
,
double
the baseline offset to be used if VPos is BASELINE
areaBaselineOffset
,
HPos
the horizontal alignment for the child within the area
halignment
,
VPos
the vertical alignment for the child within the area
valignment
)

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.

public static void
positionInArea(Node
the child being positioned within this region
child
,
double
the horizontal offset of the layout area relative to this region
areaX
,
double
the vertical offset of the layout area relative to this region
areaY
,
double
the width of the layout area
areaWidth
,
double
the height of the layout area
areaHeight
,
double
the baseline offset to be used if VPos is BASELINE
areaBaselineOffset
,
Insets
the margin of space to be allocated around the child
margin
,
HPos
the horizontal alignment for the child within the area
halignment
,
VPos
the vertical alignment for the child within the area
valignment
,
boolean
whether to snap size and position to pixels
isSnapToPixel
)

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.

public final double

Returns:

the preferred height that this node should be resized to during layout
prefHeight
(double width)

Overrides javafx.scene.Parent.prefHeight.

Called during layout to determine the preferred height for this node.

public final DoubleProperty
public final double

Returns:

the preferred width that this node should be resized to during layout
prefWidth
(double height)

Overrides javafx.scene.Parent.prefWidth.

Called during layout to determine the preferred width for this node.

public final DoubleProperty
pack-priv void
removeImageListener(Image
a non-null image
image
)

Removes the imageChangeListener from this image.

public void
resize(double
the target layout bounds width
width
,
double
the target layout bounds height
height
)

Overrides javafx.scene.Node.resize.

Invoked by the region's parent during layout to set the region's width and height.

public final BooleanProperty
public final void
public final void
public final void
setCacheShape(boolean value)

public final void
setCenterShape(boolean value)

protected void
setHeight(double value)

public final void
setMaxHeight(double value)

public void
setMaxSize(double
the override value for maximum width
maxWidth
,
double
the override value for maximum height
maxHeight
)

Convenience method for overriding the region's computed maximum width and height.

public final void
setMaxWidth(double value)

public final void
setMinHeight(double value)

public void
setMinSize(double
the override value for minimum width
minWidth
,
double
the override value for minimum height
minHeight
)

Convenience method for overriding the region's computed minimum width and height.

public final void
setMinWidth(double value)

public final void
public final void
public final void
setPrefHeight(double value)

public void
setPrefSize(double
the override value for preferred width
prefWidth
,
double
the override value for preferred height
prefHeight
)

Convenience method for overriding the region's computed preferred width and height.

public final void
setPrefWidth(double value)

public final void
setScaleShape(boolean value)

public final void
setShape(Shape value)

public final void
setSnapToPixel(boolean value)

protected void
setWidth(double value)

private boolean
shapeContains(Shape shape, final double x, final double y, double topOffset, double rightOffset, double bottomOffset, double leftOffset)

Transform x, y in local Region coordinates to local coordinates of scaled/centered shape and check if the shape contains the coordinates.

public final ObjectProperty<Shape>
public final double

Returns:

Rounded up insets bottom
snappedBottomInset
()

Utility method to get the bottom inset which includes padding and border inset.

public final double

Returns:

Rounded up insets left
snappedLeftInset
()

Utility method to get the left inset which includes padding and border inset.

public final double

Returns:

Rounded up insets right
snappedRightInset
()

Utility method to get the right inset which includes padding and border inset.

public final double

Returns:

Rounded up insets top
snappedTopInset
()

Utility method to get the top inset which includes padding and border inset.

private double

Returns:

value either as passed, or floored or ceiled with scale, based on snapToPixel
snapPortionX
(double
The value that needs to be snapped
value
,
boolean
Whether to snap to pixel
snapToPixel
)

If snapToPixel is true, then the value is either floored (positive values) or ceiled (negative values) with a scale.

pack-priv double
snapPortionX(double value)

private double

Returns:

value either as passed, or floored or ceiled with scale, based on snapToPixel
snapPortionY
(double
The value that needs to be snapped
value
,
boolean
Whether to snap to pixel
snapToPixel
)

If snapToPixel is true, then the value is either floored (positive values) or ceiled (negative values) with a scale.

pack-priv double
snapPortionY(double value)

private static double
snapPosition(double value, boolean snapToPixel, double snapScale)

protected double

Returns:

value rounded to nearest pixel
snapPosition
(double
the position value to be snapped
value
)
Deprecated since 9. replaced by snapPositionX() and snapPositionY()

If this region's snapToPixel property is false, this method returns the same value, else it tries to return a value rounded to the nearest pixel, but since there is no indication if the value is a vertical or horizontal measurement then it may be snapped to the wrong pixel size metric on screens with different horizontal and vertical scales.

private double

Returns:

value either as passed in or rounded based on snapToPixel
snapPositionX
(double
The value that needs to be snapped
value
,
boolean
Whether to snap to pixel
snapToPixel
)

If snapToPixel is true, then the value is rounded using Math.round.

public double

Returns:

value rounded to nearest pixel
snapPositionX
(double
the position value to be snapped
value
)

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.

private double
snapPositionY(double value, boolean snapToPixel)

public double

Returns:

value rounded to nearest pixel
snapPositionY
(double
the position value to be snapped
value
)

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.

private static double
snapSize(double value, boolean snapToPixel, double snapScale)

protected double

Returns:

value ceiled to nearest pixel
snapSize
(double
the size value to be snapped
value
)
Deprecated since 9. replaced by snapSizeX() and snapSizeY()

If this region's snapToPixel property is false, this method returns the same value, else it tries to return a value ceiled to the nearest pixel, but since there is no indication if the value is a vertical or horizontal measurement then it may be snapped to the wrong pixel size metric on screens with different horizontal and vertical scales.

private double

Returns:

value either as passed in or ceil'd based on snapToPixel
snapSizeX
(double
The value that needs to be snapped
value
,
boolean
Whether to snap to pixel
snapToPixel
)

If snapToPixel is true, then the value is ceil'd using Math.ceil.

public double

Returns:

value ceiled to nearest pixel
snapSizeX
(double
the size value to be snapped
value
)

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.

private double
snapSizeY(double value, boolean snapToPixel)

public double

Returns:

value ceiled to nearest pixel
snapSizeY
(double
the size value to be snapped
value
)

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.

private static double
snapSpace(double value, boolean snapToPixel, double snapScale)

protected double

Returns:

value rounded to nearest pixel
snapSpace
(double
the space value to be snapped
value
)
Deprecated since 9. replaced by snapSpaceX() and snapSpaceY()

If this region's snapToPixel property is false, this method returns the same value, else it tries to return a value rounded to the nearest pixel, but since there is no indication if the value is a vertical or horizontal measurement then it may be snapped to the wrong pixel size metric on screens with different horizontal and vertical scales.

private double

Returns:

value either as passed in or rounded based on snapToPixel
snapSpaceX
(double
The value that needs to be snapped
value
,
boolean
Whether to snap to pixel
snapToPixel
)

If snapToPixel is true, then the value is rounded using Math.round.

public double

Returns:

value rounded to nearest pixel
snapSpaceX
(double
the space value to be snapped
value
)

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.

private double
snapSpaceY(double value, boolean snapToPixel)

public double

Returns:

value rounded to nearest pixel
snapSpaceY
(double
the space value to be snapped
value
)

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.

public final BooleanProperty
private void
updateSnappedInsets()

Called to update the cached snapped insets

private void
validateCorners()

This method validates all CornerRadii objects in both the set of BackgroundFills and BorderStrokes and saves the normalized values into the private fields above.

private void
widthChanged(double value)

public final ReadOnlyDoubleProperty
Inherited from javafx.scene.Parent:
getBaselineOffsetgetChildrengetChildrenUnmodifiablegetManagedChildrengetStylesheetsisNeedsLayoutlayoutlayoutChildrenlookupneedsLayoutPropertyqueryAccessibleAttributerequestLayoutrequestParentLayoutsetNeedsLayoutupdateBounds