public class Region extends Parent
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.
A Region with a shape
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.Modifier and Type | Class and Description |
---|---|
private class |
Region.InsetsProperty |
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 |
Region.StyleableProperties
Super-lazy instantiation pattern from Bill Pugh.
|
Modifier and Type | Field 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 |
_maxHeight |
private double |
_maxWidth |
private double |
_minHeight |
private double |
_minWidth |
private double |
_prefHeight |
private double |
_prefWidth |
private Shape |
_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 ObjectProperty<Background> |
background
The background of the Region, which is made up of zero or more BackgroundFills, and
zero or more BackgroundImages.
|
private ObjectProperty<Border> |
border
The border of the Region, which is made up of zero or more BorderStrokes, and
zero or more BorderImages.
|
private Bounds |
boundingBox |
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 or height.
|
private boolean |
cornersValid |
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 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 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 java.util.List<CornerRadii> |
normalizedFillCorners |
private java.util.List<CornerRadii> |
normalizedStrokeCorners |
private ObjectProperty<Insets> |
opaqueInsets |
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 |
snappedBottomInset |
private double |
snappedLeftInset |
private double |
snappedRightInset |
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.
|
(package private) static Vec2d |
TEMP_VEC2D |
static 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 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.
|
BASELINE_OFFSET_SAME_AS_HEIGHT
Constructor and Description |
---|
Region()
Creates a new Region with an empty Background and and empty Border.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addImageListener(Image image)
Adds the imageChangeListener to this image.
|
(package private) double |
adjustHeightByMargin(double height,
Insets margin) |
(package private) double |
adjustWidthByMargin(double width,
Insets margin) |
ObjectProperty<Background> |
backgroundProperty() |
ObjectProperty<Border> |
borderProperty() |
(package private) static Vec2d |
boundedNodeSizeWithBias(Node node,
double areaWidth,
double areaHeight,
boolean fillWidth,
boolean fillHeight,
Vec2d 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.
|
(package private) static double |
boundedSize(double min,
double pref,
double max)
Computes the value based on the given min and max values.
|
BooleanProperty |
cacheShapeProperty() |
BooleanProperty |
centerShapeProperty() |
(package private) double |
computeChildMaxAreaHeight(Node child,
double maxBaselineComplement,
Insets margin,
double width) |
(package private) double |
computeChildMaxAreaWidth(Node child,
double baselineComplement,
Insets margin,
double height,
boolean fillHeight) |
(package private) double |
computeChildMinAreaHeight(Node child,
double minBaselineComplement,
Insets margin,
double width) |
(package private) double |
computeChildMinAreaHeight(Node child,
Insets margin) |
(package private) double |
computeChildMinAreaWidth(Node child,
double baselineComplement,
Insets margin,
double height,
boolean fillHeight) |
(package private) double |
computeChildMinAreaWidth(Node child,
Insets margin) |
(package private) double |
computeChildPrefAreaHeight(Node child,
double prefBaselineComplement,
Insets margin,
double width) |
(package private) double |
computeChildPrefAreaHeight(Node child,
Insets margin) |
(package private) double |
computeChildPrefAreaWidth(Node child,
double baselineComplement,
Insets margin,
double height,
boolean fillHeight) |
(package private) double |
computeChildPrefAreaWidth(Node child,
Insets margin) |
protected double |
computeMaxHeight(double width)
Computes the maximum height of this region.
|
(package private) double |
computeMaxMinAreaHeight(java.util.List<Node> children,
Callback<Node,Insets> childMargins,
double[] childWidths,
VPos valignment) |
(package private) double |
computeMaxMinAreaHeight(java.util.List<Node> children,
Callback<Node,Insets> margins,
VPos valignment) |
(package private) double |
computeMaxMinAreaHeight(java.util.List<Node> children,
Callback<Node,Insets> margins,
VPos valignment,
double width) |
(package private) double |
computeMaxMinAreaWidth(java.util.List<Node> children,
Callback<Node,Insets> margins) |
(package private) double |
computeMaxMinAreaWidth(java.util.List<Node> children,
Callback<Node,Insets> childMargins,
double[] childHeights,
boolean fillHeight) |
(package private) double |
computeMaxMinAreaWidth(java.util.List<Node> children,
Callback<Node,Insets> margins,
double height,
boolean fillHeight) |
(package private) double |
computeMaxPrefAreaHeight(java.util.List<Node> children,
Callback<Node,Insets> childMargins,
double[] childWidths,
VPos valignment) |
(package private) double |
computeMaxPrefAreaHeight(java.util.List<Node> children,
Callback<Node,Insets> margins,
double width,
VPos valignment) |
(package private) double |
computeMaxPrefAreaHeight(java.util.List<Node> children,
Callback<Node,Insets> margins,
VPos valignment) |
(package private) double |
computeMaxPrefAreaWidth(java.util.List<Node> children,
Callback<Node,Insets> margins) |
(package private) double |
computeMaxPrefAreaWidth(java.util.List<Node> children,
Callback<Node,Insets> childMargins,
double[] childHeights,
boolean fillHeight) |
(package private) double |
computeMaxPrefAreaWidth(java.util.List<Node> children,
Callback<Node,Insets> margins,
double height,
boolean fillHeight) |
protected double |
computeMaxWidth(double height)
Computes the maximum width for this region.
|
protected double |
computeMinHeight(double width)
Computes the minimum height of this region.
|
protected double |
computeMinWidth(double height)
Computes the minimum width of this region.
|
protected double |
computePrefHeight(double width)
Computes the preferred height of this region for the given width;
Region subclasses should override this method to return an appropriate
value based on their content and layout strategy.
|
protected double |
computePrefWidth(double height)
Computes the preferred width of this region for the given height.
|
private BaseBounds |
computeShapeBounds(BaseBounds bounds) |
(package private) static double |
computeXOffset(double width,
double contentWidth,
HPos hpos) |
(package private) static double |
computeYOffset(double height,
double contentHeight,
VPos vpos) |
private boolean |
contains(double px,
double py,
double x1,
double y1,
double x2,
double y2,
BorderWidths widths,
boolean filled,
Insets insets,
CornerRadii rad)
Basically we will perform two contains tests.
|
private boolean |
contains(double px,
double py,
double x1,
double y1,
double x2,
double y2,
Insets insets,
CornerRadii 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.
|
(package private) static double[] |
createDoubleArray(int length,
double value) |
(package private) double |
getAreaBaselineOffset(java.util.List<Node> children,
Callback<Node,Insets> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
boolean fillHeight) |
(package private) static double |
getAreaBaselineOffset(java.util.List<Node> children,
Callback<Node,Insets> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
boolean fillHeight,
boolean snapToPixel) |
(package private) double |
getAreaBaselineOffset(java.util.List<Node> children,
Callback<Node,Insets> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
boolean fillHeight,
double minComplement) |
(package private) static double |
getAreaBaselineOffset(java.util.List<Node> children,
Callback<Node,Insets> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
boolean fillHeight,
double minComplement,
boolean snapToPixel) |
(package private) double |
getAreaBaselineOffset(java.util.List<Node> children,
Callback<Node,Insets> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
java.util.function.Function<java.lang.Integer,java.lang.Boolean> fillHeight,
double minComplement) |
(package private) static double |
getAreaBaselineOffset(java.util.List<Node> children,
Callback<Node,Insets> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
java.util.function.Function<java.lang.Integer,java.lang.Boolean> fillHeight,
double 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. |
Background |
getBackground() |
private static double |
getBaselineComplement(java.util.List<Node> children,
boolean min,
boolean max) |
Border |
getBorder() |
static java.util.List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
java.util.List<CssMetaData<? extends Styleable,?>> |
getCssMetaData()
This method should delegate to
Node.getClassCssMetaData() so that
a Node's CssMetaData can be accessed without the need for reflection. |
double |
getHeight() |
Insets |
getInsets() |
private double |
getMaxAreaHeight(java.util.List<Node> children,
Callback<Node,Insets> childMargins,
double[] childWidths,
VPos valignment,
boolean minimum) |
private double |
getMaxAreaWidth(java.util.List<Node> children,
Callback<Node,Insets> childMargins,
double[] childHeights,
boolean fillHeight,
boolean minimum) |
(package private) static double |
getMaxBaselineComplement(java.util.List<Node> children)
Return the maximal complement of baseline
|
double |
getMaxHeight() |
double |
getMaxWidth() |
(package private) static double |
getMinBaselineComplement(java.util.List<Node> children)
Return the minimum complement of baseline
|
double |
getMinHeight() |
double |
getMinWidth() |
private CornerRadii |
getNormalizedFillCorner(int 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 |
getNormalizedStrokeCorner(int 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.
|
Insets |
getOpaqueInsets() |
Insets |
getPadding() |
(package private) static double |
getPrefBaselineComplement(java.util.List<Node> children)
Return the preferred complement of baseline
|
double |
getPrefHeight() |
double |
getPrefWidth() |
Shape |
getShape() |
java.lang.String |
getUserAgentStylesheet()
An implementation may specify its own user-agent styles for this Region, and its children,
by overriding this method.
|
double |
getWidth() |
private void |
heightChanged(double value) |
ReadOnlyDoubleProperty |
heightProperty() |
protected boolean |
impl_computeContains(double localX,
double localY)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
BaseBounds |
impl_computeGeomBounds(BaseBounds bounds,
BaseTransform tx)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
protected Bounds |
impl_computeLayoutBounds()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
NGNode |
impl_createPeer() |
protected void |
impl_notifyLayoutBoundsChanged()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
protected void |
impl_pickNodeLocal(PickRay pickRay,
PickResultChooser result)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_updatePeer()
This function is called during synchronization to update the state of the
PG Node from the FX Node.
|
ReadOnlyObjectProperty<Insets> |
insetsProperty() |
boolean |
isCacheShape() |
boolean |
isCenterShape() |
boolean |
isResizable()
Returns
true since all Regions are resizable. |
boolean |
isScaleShape() |
boolean |
isSnapToPixel() |
protected void |
layoutInArea(Node child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
HPos halignment,
VPos 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 child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
Insets margin,
boolean fillWidth,
boolean fillHeight,
HPos halignment,
VPos 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. |
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)
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(Node child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
Insets margin,
HPos halignment,
VPos 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. |
double |
maxHeight(double width)
Called during layout to determine the maximum height for this node.
|
DoubleProperty |
maxHeightProperty() |
double |
maxWidth(double height)
Called during layout to determine the maximum width for this node.
|
DoubleProperty |
maxWidthProperty() |
double |
minHeight(double width)
Called during layout to determine the minimum height for this node.
|
DoubleProperty |
minHeightProperty() |
double |
minWidth(double height)
Called during layout to determine the minimum width for this node.
|
DoubleProperty |
minWidthProperty() |
private static CornerRadii |
normalize(CornerRadii radii,
Insets insets,
double width,
double height)
Return a version of the radii that is not percentage based and is scaled to
fit the indicated inset rectangle without overflow.
|
ObjectProperty<Insets> |
opaqueInsetsProperty()
Defines the area of the region within which completely opaque pixels
are drawn.
|
ObjectProperty<Insets> |
paddingProperty() |
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 child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
HPos halignment,
VPos 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. |
static void |
positionInArea(Node child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
Insets margin,
HPos halignment,
VPos valignment,
boolean 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. |
double |
prefHeight(double width)
Called during layout to determine the preferred height for this node.
|
DoubleProperty |
prefHeightProperty() |
double |
prefWidth(double height)
Called during layout to determine the preferred width for this node.
|
DoubleProperty |
prefWidthProperty() |
(package private) void |
removeImageListener(Image image)
Removes the imageChangeListener from this image.
|
void |
resize(double width,
double height)
Invoked by the region's parent during layout to set the region's
width and height.
|
BooleanProperty |
scaleShapeProperty() |
void |
setBackground(Background value) |
void |
setBorder(Border value) |
void |
setCacheShape(boolean value) |
void |
setCenterShape(boolean value) |
protected void |
setHeight(double value) |
void |
setMaxHeight(double value) |
void |
setMaxSize(double maxWidth,
double maxHeight)
Convenience method for overriding the region's computed maximum width and height.
|
void |
setMaxWidth(double value) |
void |
setMinHeight(double value) |
void |
setMinSize(double minWidth,
double minHeight)
Convenience method for overriding the region's computed minimum width and height.
|
void |
setMinWidth(double value) |
void |
setOpaqueInsets(Insets value) |
void |
setPadding(Insets value) |
void |
setPrefHeight(double value) |
void |
setPrefSize(double prefWidth,
double prefHeight)
Convenience method for overriding the region's computed preferred width and height.
|
void |
setPrefWidth(double value) |
void |
setScaleShape(boolean value) |
void |
setShape(Shape value) |
void |
setSnapToPixel(boolean value) |
protected void |
setWidth(double value) |
private boolean |
shapeContains(Shape shape,
double x,
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.
|
ObjectProperty<Shape> |
shapeProperty() |
double |
snappedBottomInset()
Utility method to get the bottom inset which includes padding and border
inset.
|
double |
snappedLeftInset()
Utility method to get the left inset which includes padding and border
inset.
|
double |
snappedRightInset()
Utility method to get the right inset which includes padding and border
inset.
|
double |
snappedTopInset()
Utility method to get the top inset which includes padding and border
inset.
|
(package private) double |
snapPortion(double value) |
private static double |
snapPortion(double value,
boolean snapToPixel) |
protected double |
snapPosition(double value)
If this region's snapToPixel property is true, returns a value rounded
to the nearest pixel, else returns the same value.
|
private static double |
snapPosition(double value,
boolean snapToPixel)
If snapToPixel is true, then the value is rounded using Math.round.
|
protected double |
snapSize(double value)
If this region's snapToPixel property is true, returns a value ceiled
to the nearest pixel, else returns the same value.
|
private static double |
snapSize(double value,
boolean snapToPixel)
If snapToPixel is true, then the value is ceil'd using Math.ceil.
|
protected double |
snapSpace(double value)
If this region's snapToPixel property is true, returns a value rounded
to the nearest pixel, else returns the same value.
|
private static double |
snapSpace(double value,
boolean snapToPixel)
If snapToPixel is true, then the value is rounded using Math.round.
|
BooleanProperty |
snapToPixelProperty() |
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) |
ReadOnlyDoubleProperty |
widthProperty() |
getBaselineOffset, getChildren, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processCSS, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, layoutChildren, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBounds
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, 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, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, 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, 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, relocate, removeEventFilter, removeEventHandler, requestFocus, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
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.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
.static Vec2d TEMP_VEC2D
private InvalidationListener imageChangeListener
private BooleanProperty snapToPixel
private boolean _snapToPixel
private ObjectProperty<Insets> padding
private final ObjectProperty<Background> background
private final ObjectProperty<Border> border
private ObjectProperty<Insets> opaqueInsets
private final Region.InsetsProperty insets
private double snappedTopInset
private double snappedRightInset
private double snappedBottomInset
private double snappedLeftInset
private ReadOnlyDoubleWrapper width
minWidth
, prefWidth
,
and maxWidth
properties.private double _width
private ReadOnlyDoubleWrapper height
minHeight
, prefHeight
,
and maxHeight
properties.private double _height
private DoubleProperty minWidth
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.
private double _minWidth
private DoubleProperty minHeight
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.
private double _minHeight
private DoubleProperty prefWidth
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefWidth(forHeight)
will return the region's internally
computed preferred width.
private double _prefWidth
private DoubleProperty prefHeight
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefHeight(forWidth)
will return the region's internally
computed preferred width.
private double _prefHeight
private DoubleProperty maxWidth
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getMaxWidth(forHeight)
will return the region's internally
computed maximum width.
Setting this value to the USE_PREF_SIZE
flag will cause
getMaxWidth(forHeight)
to return the region's preferred width,
enabling applications to easily restrict the resizability of the region.
private double _maxWidth
private DoubleProperty maxHeight
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getMaxHeight(forWidth)
will return the region's internally
computed maximum height.
Setting this value to the USE_PREF_SIZE
flag will cause
getMaxHeight(forWidth)
to return the region's preferred height,
enabling applications to easily restrict the resizability of the region.
private double _maxHeight
private ObjectProperty<Shape> shape
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.private Shape _shape
private BooleanProperty scaleShape
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
.private BooleanProperty centerShape
true
means the shape centered within the Region's width and height,
false
means the shape is positioned at its source position.private BooleanProperty cacheShape
private boolean cornersValid
private java.util.List<CornerRadii> normalizedFillCorners
private java.util.List<CornerRadii> normalizedStrokeCorners
private Bounds boundingBox
public Region()
static double boundedSize(double min, double pref, double max)
min
- The minimum boundpref
- The value to be clamped between the min and maxmax
- the maximum bounddouble adjustWidthByMargin(double width, Insets margin)
double adjustHeightByMargin(double height, Insets margin)
private static double snapSpace(double value, boolean snapToPixel)
value
- The value that needs to be snappedsnapToPixel
- Whether to snap to pixelprivate static double snapSize(double value, boolean snapToPixel)
value
- The value that needs to be snappedsnapToPixel
- Whether to snap to pixelprivate static double snapPosition(double value, boolean snapToPixel)
value
- The value that needs to be snappedsnapToPixel
- Whether to snap to pixelprivate static double snapPortion(double value, boolean snapToPixel)
double getAreaBaselineOffset(java.util.List<Node> children, Callback<Node,Insets> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, boolean fillHeight)
static double getAreaBaselineOffset(java.util.List<Node> children, Callback<Node,Insets> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, boolean fillHeight, boolean snapToPixel)
double getAreaBaselineOffset(java.util.List<Node> children, Callback<Node,Insets> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, boolean fillHeight, double minComplement)
static double getAreaBaselineOffset(java.util.List<Node> children, Callback<Node,Insets> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, boolean fillHeight, double minComplement, boolean snapToPixel)
double getAreaBaselineOffset(java.util.List<Node> children, Callback<Node,Insets> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, java.util.function.Function<java.lang.Integer,java.lang.Boolean> fillHeight, double minComplement)
static double getAreaBaselineOffset(java.util.List<Node> children, Callback<Node,Insets> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, java.util.function.Function<java.lang.Integer,java.lang.Boolean> fillHeight, double minComplement, boolean snapToPixel)
getMinBaselineComplement(java.util.List)
from the same set of children.children
- the children with baseline alignmentmargins
- their margins (callback)positionToWidth
- callback for children widths (can return -1 if no bias is used)areaHeight
- height of the area to layout infillHeight
- callback to specify children that has fillHeight constraintminComplement
- minimum complementstatic double getMinBaselineComplement(java.util.List<Node> children)
children
- static double getPrefBaselineComplement(java.util.List<Node> children)
children
- static double getMaxBaselineComplement(java.util.List<Node> children)
children
- private static double getBaselineComplement(java.util.List<Node> children, boolean min, boolean max)
static double computeXOffset(double width, double contentWidth, HPos hpos)
static double computeYOffset(double height, double contentHeight, VPos vpos)
static double[] createDoubleArray(int length, double value)
public final boolean isSnapToPixel()
public final void setSnapToPixel(boolean value)
public final BooleanProperty snapToPixelProperty()
public final void setPadding(Insets value)
public final Insets getPadding()
public final ObjectProperty<Insets> paddingProperty()
public final void setBackground(Background value)
public final Background getBackground()
public final ObjectProperty<Background> backgroundProperty()
public final void setBorder(Border value)
public final Border getBorder()
public final ObjectProperty<Border> borderProperty()
void addImageListener(Image image)
image
- a non-null imagevoid removeImageListener(Image image)
image
- a non-null imagepublic final ObjectProperty<Insets> opaqueInsetsProperty()
public final void setOpaqueInsets(Insets value)
public final Insets getOpaqueInsets()
public final Insets getInsets()
public final ReadOnlyObjectProperty<Insets> insetsProperty()
private void updateSnappedInsets()
protected void setWidth(double value)
private void widthChanged(double value)
public final double getWidth()
public final ReadOnlyDoubleProperty widthProperty()
protected void setHeight(double value)
private void heightChanged(double value)
public final double getHeight()
public final ReadOnlyDoubleProperty heightProperty()
public final void setMinWidth(double value)
public final double getMinWidth()
public final DoubleProperty minWidthProperty()
public final void setMinHeight(double value)
public final double getMinHeight()
public final DoubleProperty minHeightProperty()
public void setMinSize(double minWidth, double minHeight)
minWidth
- the override value for minimum widthminHeight
- the override value for minimum heightsetMinWidth(double)
,
setMinHeight(double)
public final void setPrefWidth(double value)
public final double getPrefWidth()
public final DoubleProperty prefWidthProperty()
public final void setPrefHeight(double value)
public final double getPrefHeight()
public final DoubleProperty prefHeightProperty()
public void setPrefSize(double prefWidth, double prefHeight)
prefWidth
- the override value for preferred widthprefHeight
- the override value for preferred heightsetPrefWidth(double)
,
setPrefHeight(double)
public final void setMaxWidth(double value)
public final double getMaxWidth()
public final DoubleProperty maxWidthProperty()
public final void setMaxHeight(double value)
public final double getMaxHeight()
public final DoubleProperty maxHeightProperty()
public void setMaxSize(double maxWidth, double maxHeight)
maxWidth
- the override value for maximum widthmaxHeight
- the override value for maximum heightsetMaxWidth(double)
,
setMaxHeight(double)
public final Shape getShape()
public final void setShape(Shape value)
public final ObjectProperty<Shape> shapeProperty()
public final void setScaleShape(boolean value)
public final boolean isScaleShape()
public final BooleanProperty scaleShapeProperty()
public final void setCenterShape(boolean value)
public final boolean isCenterShape()
public final BooleanProperty centerShapeProperty()
public final void setCacheShape(boolean value)
public final boolean isCacheShape()
public final BooleanProperty cacheShapeProperty()
public boolean isResizable()
true
since all Regions are resizable.isResizable
in class Node
Node.getContentBias()
,
Node.minWidth(double)
,
Node.minHeight(double)
,
Node.prefWidth(double)
,
Node.prefHeight(double)
,
Node.maxWidth(double)
,
Node.maxHeight(double)
,
Node.resize(double, double)
,
Node.getLayoutBounds()
public void resize(double width, double height)
setMinSize()
,
setPrefSize()
, or setMaxSize()
and it's parent
will honor those overrides during layout.resize
in class Node
width
- the target layout bounds widthheight
- the target layout bounds heightNode.isResizable()
,
Node.getContentBias()
,
Node.autosize()
,
Node.minWidth(double)
,
Node.minHeight(double)
,
Node.prefWidth(double)
,
Node.prefHeight(double)
,
Node.maxWidth(double)
,
Node.maxHeight(double)
,
Node.getLayoutBounds()
public final double minWidth(double height)
computeMinWidth(forHeight)
unless
the application overrode the minimum width by setting the minWidth property.minWidth
in class Parent
height
- the height that should be used if minimum width depends on itsetMinWidth(double)
public final double minHeight(double width)
computeMinHeight(forWidth)
unless
the application overrode the minimum height by setting the minHeight property.minHeight
in class Parent
width
- the width that should be used if minimum height depends on itsetMinHeight(double)
public final double prefWidth(double height)
computePrefWidth(forHeight)
unless
the application overrode the preferred width by setting the prefWidth property.prefWidth
in class Parent
height
- the height that should be used if preferred width depends on itsetPrefWidth(double)
public final double prefHeight(double width)
computePrefHeight(forWidth)
unless
the application overrode the preferred height by setting the prefHeight property.prefHeight
in class Parent
width
- the width that should be used if preferred height depends on itsetPrefHeight(double)
public final double maxWidth(double height)
computeMaxWidth(forHeight)
unless
the application overrode the maximum width by setting the maxWidth property.maxWidth
in class Node
height
- the height that should be used if maximum width depends on itsetMaxWidth(double)
public final double maxHeight(double width)
computeMaxHeight(forWidth)
unless
the application overrode the maximum height by setting the maxHeight property.maxHeight
in class Node
width
- the width that should be used if maximum height depends on itsetMaxHeight(double)
protected double computeMinWidth(double height)
computeMinWidth
in class Parent
height
- the height that should be used if min width depends
on itprotected double computeMinHeight(double width)
computeMinHeight
in class Parent
width
- the width that should be used if min height depends
on itprotected double computePrefWidth(double height)
computePrefWidth
in class Parent
height
- the height that should be used if preferred width depends
on itprotected double computePrefHeight(double width)
computePrefHeight
in class Parent
width
- the width that should be used if preferred height depends
on itprotected double computeMaxWidth(double height)
protected double computeMaxHeight(double width)
protected double snapSpace(double value)
value
- the space value to be snappedprotected double snapSize(double value)
value
- the size value to be snappedprotected double snapPosition(double value)
value
- the position value to be snappeddouble snapPortion(double value)
public final double snappedTopInset()
public final double snappedBottomInset()
public final double snappedLeftInset()
public final double snappedRightInset()
double computeChildMinAreaWidth(Node child, double baselineComplement, Insets margin, double height, boolean fillHeight)
double computeChildMinAreaHeight(Node child, double minBaselineComplement, Insets margin, double width)
double computeChildPrefAreaWidth(Node child, double baselineComplement, Insets margin, double height, boolean fillHeight)
double computeChildPrefAreaHeight(Node child, double prefBaselineComplement, Insets margin, double width)
double computeChildMaxAreaWidth(Node child, double baselineComplement, Insets margin, double height, boolean fillHeight)
double computeChildMaxAreaHeight(Node child, double maxBaselineComplement, Insets margin, double width)
double computeMaxMinAreaWidth(java.util.List<Node> children, Callback<Node,Insets> margins)
double computeMaxMinAreaWidth(java.util.List<Node> children, Callback<Node,Insets> margins, double height, boolean fillHeight)
double computeMaxMinAreaWidth(java.util.List<Node> children, Callback<Node,Insets> childMargins, double[] childHeights, boolean fillHeight)
double computeMaxMinAreaHeight(java.util.List<Node> children, Callback<Node,Insets> margins, VPos valignment)
double computeMaxMinAreaHeight(java.util.List<Node> children, Callback<Node,Insets> margins, VPos valignment, double width)
double computeMaxMinAreaHeight(java.util.List<Node> children, Callback<Node,Insets> childMargins, double[] childWidths, VPos valignment)
double computeMaxPrefAreaWidth(java.util.List<Node> children, Callback<Node,Insets> margins)
double computeMaxPrefAreaWidth(java.util.List<Node> children, Callback<Node,Insets> margins, double height, boolean fillHeight)
double computeMaxPrefAreaWidth(java.util.List<Node> children, Callback<Node,Insets> childMargins, double[] childHeights, boolean fillHeight)
double computeMaxPrefAreaHeight(java.util.List<Node> children, Callback<Node,Insets> margins, VPos valignment)
double computeMaxPrefAreaHeight(java.util.List<Node> children, Callback<Node,Insets> margins, double width, VPos valignment)
double computeMaxPrefAreaHeight(java.util.List<Node> children, Callback<Node,Insets> childMargins, double[] childWidths, VPos valignment)
static Vec2d boundedNodeSizeWithBias(Node node, double areaWidth, double areaHeight, boolean fillWidth, boolean fillHeight, Vec2d result)
node
- the nodeareaWidth
- the width of the bounding area where the node is going to be placedareaHeight
- the height of the bounding area where the node is going to be placedfillWidth
- if Node should try to fill the area widthfillHeight
- if Node should try to fill the area heightresult
- Vec2d object for the result or null if new one should be createdprivate double getMaxAreaHeight(java.util.List<Node> children, Callback<Node,Insets> childMargins, double[] childWidths, VPos valignment, boolean minimum)
private double getMaxAreaWidth(java.util.List<Node> children, Callback<Node,Insets> childMargins, double[] childHeights, boolean fillHeight, boolean minimum)
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.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEhalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areapublic 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.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEmargin
- the margin of space to be allocated around the childhalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areaprotected 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.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEhalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areaprotected 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.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEmargin
- the margin of space to be allocated around the childhalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areaprotected 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.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEmargin
- the margin of space to be allocated around the childfillWidth
- whether or not the child should be resized to fill the area width or kept to its preferred widthfillHeight
- whether or not the child should e resized to fill the area height or kept to its preferred heighthalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areapublic 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.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEmargin
- the margin of space to be allocated around the childfillWidth
- whether or not the child should be resized to fill the area width or kept to its preferred widthfillHeight
- whether or not the child should e resized to fill the area height or kept to its preferred heighthalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areaisSnapToPixel
- whether to snap size and position to pixelsprivate 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)
public void impl_updatePeer()
Node
impl_updatePeer
in class Parent
public NGNode impl_createPeer()
impl_createPeer
in class Parent
private boolean shapeContains(Shape shape, double x, double y, double topOffset, double rightOffset, double bottomOffset, double leftOffset)
@Deprecated protected boolean impl_computeContains(double localX, double localY)
impl_computeContains
in class Parent
private boolean contains(double px, double py, double x1, double y1, double x2, double y2, BorderWidths widths, boolean filled, Insets insets, CornerRadii rad)
px
- The x position of the point to testpy
- The y position of the point to testx1
- The x1 position of the bounds to testy1
- The y1 position of the bounds to testx2
- The x2 position of the bounds to testy2
- The y2 position of the bounds to testwidths
- The widths of the stroke on each sidefilled
- Whether the area is filled or is just strokedinsets
- The insets to apply to (x1,y1)-(x2,y2) to get the final bounds to testrad
- The corner radii to test with. Must not be null.maxRadius
- The maximum possible radius valueprivate boolean contains(double px, double py, double x1, double y1, double x2, double y2, Insets insets, CornerRadii rad)
px
- The x position of the point to testpy
- The y position of the point to testx1
- The x1 position of the bounds to testy1
- The y1 position of the bounds to testx2
- The x2 position of the bounds to testy2
- The y2 position of the bounds to testinsets
- The insets to apply to (x1,y1)-(x2,y2) to get the final bounds to testrad
- The corner radii to test with. Must not be null.maxRadius
- The maximum possible radius valueprivate CornerRadii getNormalizedFillCorner(int i)
i
- the index of the BackgroundFill whose radii will be normalized.private CornerRadii getNormalizedStrokeCorner(int i)
i
- the index of the BorderStroke whose radii will be normalized.private void validateCorners()
private static CornerRadii normalize(CornerRadii radii, Insets insets, double width, double height)
radii
- The radii.insets
- The insets for the associated background or stroke.width
- The width of the region before insets are applied.height
- The height of the region before insets are applied.@Deprecated protected void impl_pickNodeLocal(PickRay pickRay, PickResultChooser result)
impl_pickNodeLocal
in class Parent
@Deprecated protected final Bounds impl_computeLayoutBounds()
0, 0 width x height
impl_computeLayoutBounds
in class Node
@Deprecated protected final void impl_notifyLayoutBoundsChanged()
Node
impl_notifyLayoutBoundsChanged
in class Node
private BaseBounds computeShapeBounds(BaseBounds bounds)
@Deprecated public BaseBounds impl_computeGeomBounds(BaseBounds bounds, BaseTransform tx)
Node
impl_computeGeomBounds
in class Parent
public java.lang.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.
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.public static java.util.List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public java.util.List<CssMetaData<? extends Styleable,?>> getCssMetaData()
Node.getClassCssMetaData()
so that
a Node's CssMetaData can be accessed without the need for reflection.getCssMetaData
in interface Styleable
getCssMetaData
in class Node