[13:6] static extends: object
Enum representing scroll bar policies for a ScrollPane.
The SpPolicy options include: ALWAYS, which always shows the scrollbar;
AS_NEEDED, which displays the scrollbar only when necessary; and NEVER,
which hides the scrollbar at all times.
[131:7] extends: Control
The ScrollPane class wraps the JavaFX ScrollPane control, which provides a scrollable viewport for any Node content that may be larger than the visible area. When the content exceeds the viewport, horizontal and/or vertical scrollbars appear according to the configured bar policies. ScrollPane also supports a pannable mode that lets the user drag the content with the mouse instead of using the scrollbars, and fit-to-width/height options that resize the content to match the viewport dimensions. The tables below list every CSS property available to ScrollPane, organized by the class level where each property is defined.
| Pseudo-class | Description |
|---|---|
pannable |
Applies when the pannable property is true. |
fitToWidth |
Applies when the fitToWidth property is true. |
fitToHeight |
Applies when the fitToHeight property is true. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-fit-to-width |
true | false |
false |
When true, content is resized to match the viewport width. |
-fx-fit-to-height |
true | false |
false |
When true, content is resized to match the viewport height. |
-fx-pannable |
true | false |
false |
When true, the user can pan the content by pressing and dragging. |
-fx-hbar-policy |
never | always | as-needed |
as-needed |
Horizontal scrollbar display policy. |
-fx-vbar-policy |
never | always | as-needed |
as-needed |
Vertical scrollbar display policy. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-skin |
<string> |
null |
Fully qualified class name of the Skin to use for rendering this control. |
-fx-focus-traversable |
true | false |
true |
When true, the control participates in focus traversal via the keyboard Tab key. (Default is false for Accordion, ScrollPane.) |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-background-color |
<paint> [, <paint>]* |
transparent |
One or more paint values for background fill layers, rendered back to front. |
-fx-background-insets |
<size> or <t> <r> <b> <l> [, ...]* |
0 0 0 0 |
Insets from the region edges for each background fill layer. |
-fx-background-radius |
<size> [/ <size>]* [, ...]* |
0 0 0 0 |
Corner radii for each background fill layer. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-background-image |
<uri> [, <uri>]* |
null |
One or more image URIs for background image layers. |
-fx-background-position |
<bg-position> [, ...]* |
0% 0% |
Position of each background image within the region. Accepts keywords or size values. |
-fx-background-repeat |
<repeat-style> [, ...]* |
repeat repeat |
Tiling behavior for each background image. Values: repeat, no-repeat, round, space applied per axis. |
-fx-background-size |
<bg-size> [, ...]* |
auto auto |
Dimensions for each background image. Supports cover, contain, stretch, or explicit sizes. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-border-color |
<paint> or <t> <r> <b> <l> [, ...]* |
null |
Paint colors for the border stroke layers. |
-fx-border-insets |
<size> or <t> <r> <b> <l> [, ...]* |
null |
Insets from region edges for each border layer. |
-fx-border-radius |
<size> [, ...]* |
null |
Corner radii for border stroke layers. |
-fx-border-style |
<border-style> [, ...]* |
null |
Border line style (solid, dotted, dashed) plus phase and line cap/join options per layer. |
-fx-border-width |
<size> or <t> <r> <b> <l> [, ...]* |
null |
Thickness of each border stroke layer, per side. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-border-image-source |
<uri> [, <uri>]* |
null |
Image URIs used to paint the border. |
-fx-border-image-insets |
<size> or <t> <r> <b> <l> [, ...]* |
0 0 0 0 |
Insets for each border image layer. |
-fx-border-image-repeat |
<repeat-style> [, ...]* |
repeat repeat |
Tiling behavior for each border image. |
-fx-border-image-slice |
<size> or <t> <r> <b> <l> [fill] [, ...]* |
100% |
Divides each border image into nine regions. Adding fill preserves the center region. |
-fx-border-image-width |
<size> or <t> <r> <b> <l> [, ...]* |
1 1 1 1 |
Width of each border image slice per side. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-padding |
<size> or <t> <r> <b> <l> |
0 0 0 0 |
Interior padding between the region border and its content. |
-fx-shape |
<string> |
null |
SVG path string that defines a custom clip shape for the region. |
-fx-scale-shape |
true | false |
true |
When true, the shape is scaled to fit the region. |
-fx-position-shape |
true | false |
true |
When true, the shape is centered within the region. |
-fx-snap-to-pixel |
true | false |
true |
When true, positions and sizes are rounded to whole pixel boundaries. |
-fx-min-width |
<size> |
-1 |
Minimum width. -1 uses the computed minimum. |
-fx-pref-width |
<size> |
-1 |
Preferred width. -1 uses the computed preferred. |
-fx-max-width |
<size> |
-1 |
Maximum width. -1 uses the computed maximum. |
-fx-min-height |
<size> |
-1 |
Minimum height. -1 uses the computed minimum. |
-fx-pref-height |
<size> |
-1 |
Preferred height. -1 uses the computed preferred. |
-fx-max-height |
<size> |
-1 |
Maximum height. -1 uses the computed maximum. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-blend-mode |
add | blue | color-burn | color-dodge | darken | difference | exclusion | green | hard-light | lighten | multiply | overlay | red | screen | soft-light | src-atop | src-in | src-out | src-over |
null |
Blend mode used when compositing this node with nodes beneath it. |
-fx-cursor |
null | crosshair | default | hand | move | e-resize | h-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | v-resize | text | wait | <url> |
null (inherits) |
Mouse cursor shape shown when the pointer is over this node. Inherits from parent by default. |
-fx-effect |
<effect> |
null |
A visual effect (e.g. DropShadow, InnerShadow) applied to the rendered node. |
-fx-focus-traversable |
true | false |
false |
Whether this node participates in focus traversal. Overridden to true by Control. |
-fx-view-order |
<number> |
0 |
Adjusts rendering and hit-test order within the parent without changing the scene graph order. |
-fx-opacity |
<number> [0.0 - 1.0] |
1 |
Opacity of the node. 0 is fully transparent, 1 is fully opaque. |
-fx-rotate |
<number> |
0 |
Rotation angle in degrees applied around the node's center point. Positive values are clockwise. |
-fx-scale-x |
<number> |
1 |
Scale factor along the X axis about the node's center. |
-fx-scale-y |
<number> |
1 |
Scale factor along the Y axis about the node's center. |
-fx-scale-z |
<number> |
1 |
Scale factor along the Z axis about the node's center. |
-fx-translate-x |
<number> |
0 |
Translation offset along the X axis in pixels. |
-fx-translate-y |
<number> |
0 |
Translation offset along the Y axis in pixels. |
-fx-translate-z |
<number> |
0 |
Translation offset along the Z axis in pixels. |
visibility |
visible | hidden | collapse | inherit |
visible |
Controls whether the node is rendered and participates in layout. collapse removes it from layout; hidden keeps the space. |
-fx-managed |
true | false |
true |
When false, the parent layout does not manage this node's position or size. |
ScrollPane ()
Initializes a new ScrollPane instance.
this objectsetContent (Val)
Sets the content to be displayed within the ScrollPane.
Val The Node object to set as the content.voidsetHBarPolicy (Policy)
Sets the horizontal scroll bar policy for the ScrollPane.
Policy The scroll bar policy, using values from SpPolicy (e.g., SpPolicy.ALWAYS).this object for chainingsetVBarPolicy (Policy)
Sets the vertical scroll bar policy for the ScrollPane.
Policy The scroll bar policy, using values from SpPolicy (e.g., SpPolicy.AS_NEEDED).this object for chaininggetContent ()
Returns the content node currently displayed inside the ScrollPane.
A Node with the current content, or null if none is set.setFitToWidth (bool Fit)
Sets whether the content width is expanded to match the viewport width.
Fit is a bool with true to fit content to the viewport width.this object for chainingsetFitToHeight (bool Fit)
Sets whether the content height is expanded to match the viewport height.
Fit is a bool with true to fit content to the viewport height.this object for chainingsetPannable (bool Pannable)
Sets whether the user can pan the content by pressing and dragging.
Pannable is a bool with true to enable panning.this object for chainingsetHvalue (double Value)
Sets the current horizontal scroll position as a value between 0.0 and 1.0.
Value is a double with the horizontal scroll position.this object for chainingsetVvalue (double Value)
Sets the current vertical scroll position as a value between 0.0 and 1.0.
Value is a double with the vertical scroll position.this object for chainingsetId (string Id)
Sets the CSS id of this ScrollPane node.
Id is a string with the CSS id.this object for chainingsetPrefSize (double Width, double Height)
Sets the preferred width and height of the ScrollPane.
Width is a double with the preferred width in pixels.Height is a double with the preferred height in pixels.this object for chaininggetHbarPolicy ()
Returns the horizontal scroll bar policy.
An AJO wrapping javafx.scene.control.ScrollPane.ScrollBarPolicy.hbarPolicyProperty ()
Returns the ObjectProperty backing the horizontal scroll bar policy.
An ObjectPropertygetVbarPolicy ()
Returns the vertical scroll bar policy.
An AJO wrapping javafx.scene.control.ScrollPane.ScrollBarPolicy.vbarPolicyProperty ()
Returns the ObjectProperty backing the vertical scroll bar policy.
An ObjectPropertycontentProperty ()
Returns the ObjectProperty backing the content node.
An ObjectPropertygetHvalue ()
Returns the current horizontal scroll position.
A double in the range [hmin, hmax].hvalueProperty ()
Returns the DoubleProperty backing the horizontal scroll position.
A DoubleProperty AJO.getVvalue ()
Returns the current vertical scroll position.
A double in the range [vmin, vmax].vvalueProperty ()
Returns the DoubleProperty backing the vertical scroll position.
A DoubleProperty AJO.setHmin (double Val)
Sets the minimum horizontal scroll position.
Val is a double with the minimum hvalue.this object for chaininggetHmin ()
Returns the minimum horizontal scroll position.
A double with the hmin value.hminProperty ()
Returns the DoubleProperty backing the hmin value.
A DoubleProperty AJO.setVmin (double Val)
Sets the minimum vertical scroll position.
Val is a double with the minimum vvalue.this object for chaininggetVmin ()
Returns the minimum vertical scroll position.
A double with the vmin value.vminProperty ()
Returns the DoubleProperty backing the vmin value.
A DoubleProperty AJO.setHmax (double Val)
Sets the maximum horizontal scroll position.
Val is a double with the maximum hvalue.this object for chaininggetHmax ()
Returns the maximum horizontal scroll position.
A double with the hmax value.hmaxProperty ()
Returns the DoubleProperty backing the hmax value.
A DoubleProperty AJO.setVmax (double Val)
Sets the maximum vertical scroll position.
Val is a double with the maximum vvalue.this object for chaininggetVmax ()
Returns the maximum vertical scroll position.
A double with the vmax value.vmaxProperty ()
Returns the DoubleProperty backing the vmax value.
A DoubleProperty AJO.isFitToWidth ()
Returns whether the content is resized to match the viewport width.
A bool true when fit-to-width is enabled.fitToWidthProperty ()
Returns the BooleanProperty backing fit-to-width.
A BooleanProperty AJO.isFitToHeight ()
Returns whether the content is resized to match the viewport height.
A bool true when fit-to-height is enabled.fitToHeightProperty ()
Returns the BooleanProperty backing fit-to-height.
A BooleanProperty AJO.isPannable ()
Returns whether the user can pan the content by pressing and dragging.
A bool true when pannable.pannableProperty ()
Returns the BooleanProperty backing pannable.
A BooleanProperty AJO.setPrefViewportWidth (double Val)
Sets the preferred width of the viewport.
Val is a double with the preferred viewport width.this object for chaininggetPrefViewportWidth ()
Returns the preferred width of the viewport.
A double with the preferred viewport width.prefViewportWidthProperty ()
Returns the DoubleProperty backing the preferred viewport width.
A DoubleProperty AJO.setPrefViewportHeight (double Val)
Sets the preferred height of the viewport.
Val is a double with the preferred viewport height.this object for chaininggetPrefViewportHeight ()
Returns the preferred height of the viewport.
A double with the preferred viewport height.prefViewportHeightProperty ()
Returns the DoubleProperty backing the preferred viewport height.
A DoubleProperty AJO.setMinViewportWidth (double Val)
Sets the minimum viewport width.
Val is a double with the minimum viewport width.this object for chaininggetMinViewportWidth ()
Returns the minimum viewport width.
A double with the minimum viewport width.minViewportWidthProperty ()
Returns the DoubleProperty backing the minimum viewport width.
A DoubleProperty AJO.setMinViewportHeight (double Val)
Sets the minimum viewport height.
Val is a double with the minimum viewport height.this object for chaininggetMinViewportHeight ()
Returns the minimum viewport height.
A double with the minimum viewport height.minViewportHeightProperty ()
Returns the DoubleProperty backing the minimum viewport height.
A DoubleProperty AJO.setViewportBounds (object Bbounds)
Sets the viewport bounds.
Bbounds is a Bounds wrapper for the new viewport bounds.this object for chaininggetViewportBounds ()
Returns the current viewport bounds as a JavaFX Bounds.
An AJO wrapping javafx.geometry.Bounds.viewportBoundsProperty ()
Returns the ObjectProperty backing the viewport bounds.
An ObjectProperty