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.Type | Property and Description |
---|---|
ObjectProperty<Background> |
background
The background of the Region, which is made up of zero or more BackgroundFills, and
zero or more BackgroundImages.
|
ObjectProperty<Border> |
border
The border of the Region, which is made up of zero or more BorderStrokes, and
zero or more BorderImages.
|
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.
|
BooleanProperty |
centerShape
Defines whether the shape is centered within the Region's width or height.
|
ReadOnlyDoubleProperty |
height
The height of this resizable node.
|
ReadOnlyObjectProperty<Insets> |
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.
|
DoubleProperty |
maxHeight
Property for overriding the region's computed maximum height.
|
DoubleProperty |
maxWidth
Property for overriding the region's computed maximum width.
|
DoubleProperty |
minHeight
Property for overriding the region's computed minimum height.
|
DoubleProperty |
minWidth
Property for overriding the region's computed minimum width.
|
ObjectProperty<Insets> |
opaqueInsets
Defines the area of the region within which completely opaque pixels
are drawn.
|
ObjectProperty<Insets> |
padding
The top, right, bottom, and left padding around the region's content.
|
DoubleProperty |
prefHeight
Property for overriding the region's computed preferred height.
|
DoubleProperty |
prefWidth
Property for overriding the region's computed preferred width.
|
BooleanProperty |
scaleShape
Specifies whether the shape, if defined, is scaled to match the size of the Region.
|
ObjectProperty<Shape> |
shape
When specified, the
shape will cause the region to be
rendered as the specified shape rather than as a rounded rectangle. |
BooleanProperty |
snapToPixel
Defines whether this region adjusts position, spacing, and size values of
its children to pixel boundaries.
|
ReadOnlyDoubleProperty |
width
The width of this resizable node.
|
needsLayout
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, visible
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()
The background of the Region, which is made up of zero or more BackgroundFills, and
zero or more BackgroundImages.
|
ObjectProperty<Border> |
borderProperty()
The border of the Region, which is made up of zero or more BorderStrokes, and
zero or more BorderImages.
|
BooleanProperty |
cacheShapeProperty()
Defines a hint to the system indicating that the Shape used to define the region's
background is stable and would benefit from caching.
|
BooleanProperty |
centerShapeProperty()
Defines whether the shape is centered within the Region's width or height.
|
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()
Gets the value of the property background.
|
Border |
getBorder()
Gets the value of the property border.
|
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()
Gets the value of the property height.
|
Insets |
getInsets()
Gets the value of the property insets.
|
double |
getMaxHeight()
Gets the value of the property maxHeight.
|
double |
getMaxWidth()
Gets the value of the property maxWidth.
|
double |
getMinHeight()
Gets the value of the property minHeight.
|
double |
getMinWidth()
Gets the value of the property minWidth.
|
Insets |
getOpaqueInsets()
Gets the value of the property opaqueInsets.
|
Insets |
getPadding()
Gets the value of the property padding.
|
double |
getPrefHeight()
Gets the value of the property prefHeight.
|
double |
getPrefWidth()
Gets the value of the property prefWidth.
|
Shape |
getShape()
Gets the value of the property shape.
|
String |
getUserAgentStylesheet()
An implementation may specify its own user-agent styles for this Region, and its children,
by overriding this method.
|
double |
getWidth()
Gets the value of the property width.
|
ReadOnlyDoubleProperty |
heightProperty()
The height of this resizable node.
|
ReadOnlyObjectProperty<Insets> |
insetsProperty()
The insets of the Region define the distance from the edge of the region (its layout bounds,
or (0, 0, width, height)) to the edge of the content area.
|
boolean |
isCacheShape()
Gets the value of the property cacheShape.
|
boolean |
isCenterShape()
Gets the value of the property centerShape.
|
boolean |
isResizable()
Returns
true since all Regions are resizable. |
boolean |
isScaleShape()
Gets the value of the property scaleShape.
|
boolean |
isSnapToPixel()
Gets the value of the property snapToPixel.
|
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()
Property for overriding the region's computed maximum height.
|
double |
maxWidth(double height)
Called during layout to determine the maximum width for this node.
|
DoubleProperty |
maxWidthProperty()
Property for overriding the region's computed maximum width.
|
double |
minHeight(double width)
Called during layout to determine the minimum height for this node.
|
DoubleProperty |
minHeightProperty()
Property for overriding the region's computed minimum height.
|
double |
minWidth(double height)
Called during layout to determine the minimum width for this node.
|
DoubleProperty |
minWidthProperty()
Property for overriding the region's computed minimum width.
|
ObjectProperty<Insets> |
opaqueInsetsProperty()
Defines the area of the region within which completely opaque pixels
are drawn.
|
ObjectProperty<Insets> |
paddingProperty()
The top, right, bottom, and left padding around the region's content.
|
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()
Property for overriding the region's computed preferred height.
|
double |
prefWidth(double height)
Called during layout to determine the preferred width for this node.
|
DoubleProperty |
prefWidthProperty()
Property for overriding the region's computed preferred width.
|
void |
resize(double width,
double height)
Invoked by the region's parent during layout to set the region's
width and height.
|
BooleanProperty |
scaleShapeProperty()
Specifies whether the shape, if defined, is scaled to match the size of the Region.
|
void |
setBackground(Background value)
Sets the value of the property background.
|
void |
setBorder(Border value)
Sets the value of the property border.
|
void |
setCacheShape(boolean value)
Sets the value of the property cacheShape.
|
void |
setCenterShape(boolean value)
Sets the value of the property centerShape.
|
protected void |
setHeight(double value)
Sets the value of the property height.
|
void |
setMaxHeight(double value)
Sets the value of the property maxHeight.
|
void |
setMaxSize(double maxWidth,
double maxHeight)
Convenience method for overriding the region's computed maximum width and height.
|
void |
setMaxWidth(double value)
Sets the value of the property maxWidth.
|
void |
setMinHeight(double value)
Sets the value of the property minHeight.
|
void |
setMinSize(double minWidth,
double minHeight)
Convenience method for overriding the region's computed minimum width and height.
|
void |
setMinWidth(double value)
Sets the value of the property minWidth.
|
void |
setOpaqueInsets(Insets value)
Sets the value of the property opaqueInsets.
|
void |
setPadding(Insets value)
Sets the value of the property padding.
|
void |
setPrefHeight(double value)
Sets the value of the property prefHeight.
|
void |
setPrefSize(double prefWidth,
double prefHeight)
Convenience method for overriding the region's computed preferred width and height.
|
void |
setPrefWidth(double value)
Sets the value of the property prefWidth.
|
void |
setScaleShape(boolean value)
Sets the value of the property scaleShape.
|
void |
setShape(Shape value)
Sets the value of the property shape.
|
void |
setSnapToPixel(boolean value)
Sets the value of the property snapToPixel.
|
protected void |
setWidth(double value)
Sets the value of the property width.
|
ObjectProperty<Shape> |
shapeProperty()
When specified, the
shape will cause the region to be
rendered as the specified shape rather than as a rounded rectangle. |
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()
Defines whether this region adjusts position, spacing, and size values of
its children to pixel boundaries.
|
ReadOnlyDoubleProperty |
widthProperty()
The width of this resizable node.
|
getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, 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, 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 final BooleanProperty snapToPixelProperty
isSnapToPixel()
,
setSnapToPixel(boolean)
public final ObjectProperty<Insets> paddingProperty
getPadding()
,
setPadding(Insets)
public final ObjectProperty<Background> backgroundProperty
getBackground()
,
setBackground(Background)
public final ObjectProperty<Border> borderProperty
getBorder()
,
setBorder(Border)
public final ObjectProperty<Insets> opaqueInsetsProperty
getOpaqueInsets()
,
setOpaqueInsets(Insets)
public final ReadOnlyObjectProperty<Insets> insetsProperty
getInsets()
public final ReadOnlyDoubleProperty widthProperty
minWidth
, prefWidth
,
and maxWidth
properties.getWidth()
,
setWidth(double)
public final ReadOnlyDoubleProperty heightProperty
minHeight
, prefHeight
,
and maxHeight
properties.getHeight()
,
setHeight(double)
public final DoubleProperty minWidthProperty
Defaults to the USE_COMPUTED_SIZE
flag, which means that
minWidth(forHeight)
will return the region's internally
computed minimum width.
Setting this value to the USE_PREF_SIZE
flag will cause
minWidth(forHeight)
to return the region's preferred width,
enabling applications to easily restrict the resizability of the region.
getMinWidth()
,
setMinWidth(double)
public final DoubleProperty minHeightProperty
Defaults to the USE_COMPUTED_SIZE
flag, which means that
minHeight(forWidth)
will return the region's internally
computed minimum height.
Setting this value to the USE_PREF_SIZE
flag will cause
minHeight(forWidth)
to return the region's preferred height,
enabling applications to easily restrict the resizability of the region.
getMinHeight()
,
setMinHeight(double)
public final DoubleProperty prefWidthProperty
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefWidth(forHeight)
will return the region's internally
computed preferred width.
getPrefWidth()
,
setPrefWidth(double)
public final DoubleProperty prefHeightProperty
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefHeight(forWidth)
will return the region's internally
computed preferred width.
getPrefHeight()
,
setPrefHeight(double)
public final DoubleProperty maxWidthProperty
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.
getMaxWidth()
,
setMaxWidth(double)
public final DoubleProperty maxHeightProperty
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.
getMaxHeight()
,
setMaxHeight(double)
public final ObjectProperty<Shape> shapeProperty
shape
will cause the region to be
rendered as the specified shape rather than as a rounded rectangle.
When null, the Region is rendered as a rounded rectangle. When rendered
as a Shape, any Background is used to fill the shape, although any
background insets are ignored as are background radii. Any BorderStrokes
defined are used for stroking the shape. Any BorderImages are ignored.getShape()
,
setShape(Shape)
public final BooleanProperty scaleShapeProperty
true
means the shape is scaled to fit the size of the Region, false
means the shape is at its source size, its positioning depends on the value of
centerShape
.isScaleShape()
,
setScaleShape(boolean)
public final BooleanProperty centerShapeProperty
true
means the shape centered within the Region's width and height,
false
means the shape is positioned at its source position.isCenterShape()
,
setCenterShape(boolean)
public final BooleanProperty cacheShapeProperty
isCacheShape()
,
setCacheShape(boolean)
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()
isSnapToPixel()
,
setSnapToPixel(boolean)
public final void setPadding(Insets value)
public final Insets getPadding()
public final ObjectProperty<Insets> paddingProperty()
getPadding()
,
setPadding(Insets)
public final void setBackground(Background value)
public final Background getBackground()
public final ObjectProperty<Background> backgroundProperty()
getBackground()
,
setBackground(Background)
public final void setBorder(Border value)
public final Border getBorder()
public final ObjectProperty<Border> borderProperty()
getBorder()
,
setBorder(Border)
public final ObjectProperty<Insets> opaqueInsetsProperty()
getOpaqueInsets()
,
setOpaqueInsets(Insets)
public final void setOpaqueInsets(Insets value)
public final Insets getOpaqueInsets()
public final Insets getInsets()
public final ReadOnlyObjectProperty<Insets> insetsProperty()
getInsets()
protected void setWidth(double value)
minWidth
, prefWidth
,
and maxWidth
properties.public final double getWidth()
minWidth
, prefWidth
,
and maxWidth
properties.public final ReadOnlyDoubleProperty widthProperty()
minWidth
, prefWidth
,
and maxWidth
properties.getWidth()
,
setWidth(double)
protected void setHeight(double value)
minHeight
, prefHeight
,
and maxHeight
properties.public final double getHeight()
minHeight
, prefHeight
,
and maxHeight
properties.public final ReadOnlyDoubleProperty heightProperty()
minHeight
, prefHeight
,
and maxHeight
properties.getHeight()
,
setHeight(double)
public final void setMinWidth(double value)
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.
public final double getMinWidth()
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.
public final DoubleProperty minWidthProperty()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
minWidth(forHeight)
will return the region's internally
computed minimum width.
Setting this value to the USE_PREF_SIZE
flag will cause
minWidth(forHeight)
to return the region's preferred width,
enabling applications to easily restrict the resizability of the region.
getMinWidth()
,
setMinWidth(double)
public final void setMinHeight(double value)
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.
public final double getMinHeight()
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.
public final DoubleProperty minHeightProperty()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
minHeight(forWidth)
will return the region's internally
computed minimum height.
Setting this value to the USE_PREF_SIZE
flag will cause
minHeight(forWidth)
to return the region's preferred height,
enabling applications to easily restrict the resizability of the region.
getMinHeight()
,
setMinHeight(double)
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)
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefWidth(forHeight)
will return the region's internally
computed preferred width.
public final double getPrefWidth()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefWidth(forHeight)
will return the region's internally
computed preferred width.
public final DoubleProperty prefWidthProperty()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefWidth(forHeight)
will return the region's internally
computed preferred width.
getPrefWidth()
,
setPrefWidth(double)
public final void setPrefHeight(double value)
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefHeight(forWidth)
will return the region's internally
computed preferred width.
public final double getPrefHeight()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefHeight(forWidth)
will return the region's internally
computed preferred width.
public final DoubleProperty prefHeightProperty()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefHeight(forWidth)
will return the region's internally
computed preferred width.
getPrefHeight()
,
setPrefHeight(double)
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)
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.
public final double getMaxWidth()
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.
public final DoubleProperty maxWidthProperty()
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.
getMaxWidth()
,
setMaxWidth(double)
public final void setMaxHeight(double value)
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.
public final double getMaxHeight()
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.
public final DoubleProperty maxHeightProperty()
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.
getMaxHeight()
,
setMaxHeight(double)
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()
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.public final void setShape(Shape value)
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.public final ObjectProperty<Shape> shapeProperty()
shape
will cause the region to be
rendered as the specified shape rather than as a rounded rectangle.
When null, the Region is rendered as a rounded rectangle. When rendered
as a Shape, any Background is used to fill the shape, although any
background insets are ignored as are background radii. Any BorderStrokes
defined are used for stroking the shape. Any BorderImages are ignored.getShape()
,
setShape(Shape)
public final void setScaleShape(boolean value)
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
.public final boolean isScaleShape()
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
.public final BooleanProperty scaleShapeProperty()
true
means the shape is scaled to fit the size of the Region, false
means the shape is at its source size, its positioning depends on the value of
centerShape
.isScaleShape()
,
setScaleShape(boolean)
public final void setCenterShape(boolean value)
true
means the shape centered within the Region's width and height,
false
means the shape is positioned at its source position.public final boolean isCenterShape()
true
means the shape centered within the Region's width and height,
false
means the shape is positioned at its source position.public final BooleanProperty centerShapeProperty()
true
means the shape centered within the Region's width and height,
false
means the shape is positioned at its source position.isCenterShape()
,
setCenterShape(boolean)
public final void setCacheShape(boolean value)
public final boolean isCacheShape()
public final BooleanProperty cacheShapeProperty()
isCacheShape()
,
setCacheShape(boolean)
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 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
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2019, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.