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 | Field and Description |
---|---|
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. |
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 |
---|---|
ObjectProperty<Background> |
backgroundProperty() |
ObjectProperty<Border> |
borderProperty() |
BooleanProperty |
cacheShapeProperty() |
BooleanProperty |
centerShapeProperty() |
protected double |
computeMaxHeight(double width)
Computes the maximum height of this region.
|
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.
|
Background |
getBackground() |
Border |
getBorder() |
static List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
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() |
double |
getMaxHeight() |
double |
getMaxWidth() |
double |
getMinHeight() |
double |
getMinWidth() |
Insets |
getOpaqueInsets() |
Insets |
getPadding() |
double |
getPrefHeight() |
double |
getPrefWidth() |
Shape |
getShape() |
String |
getUserAgentStylesheet()
An implementation may specify its own user-agent styles for this Region, and its children,
by overriding this method.
|
double |
getWidth() |
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() |
ObjectProperty<Insets> |
opaqueInsetsProperty()
Defines the area of the region within which completely opaque pixels
are drawn.
|
ObjectProperty<Insets> |
paddingProperty() |
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() |
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) |
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.
|
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.
|
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.
|
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.
|
BooleanProperty |
snapToPixelProperty() |
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
.public Region()
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()
public final ObjectProperty<Insets> opaqueInsetsProperty()
public final void setOpaqueInsets(Insets value)
public final Insets getOpaqueInsets()
public final Insets getInsets()
public final ReadOnlyObjectProperty<Insets> insetsProperty()
protected void setWidth(double value)
public final double getWidth()
public final ReadOnlyDoubleProperty widthProperty()
protected void setHeight(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 snappedpublic final double snappedTopInset()
public final double snappedBottomInset()
public final double snappedLeftInset()
public final double snappedRightInset()
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 pixelspublic void impl_updatePeer()
Node
impl_updatePeer
in class Parent
public NGNode impl_createPeer()
impl_createPeer
in class Parent
@Deprecated protected boolean impl_computeContains(double localX, double localY)
impl_computeContains
in class Parent
@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
@Deprecated public BaseBounds impl_computeGeomBounds(BaseBounds bounds, BaseTransform tx)
Node
impl_computeGeomBounds
in class Parent
public String getUserAgentStylesheet()
The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.
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 List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public 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
Copyright © 2020. All rights reserved.