Basics
Guides
API Reference
Basics
Guides
API Reference
[114:7] extends: Control
The ScrollBar class wraps the JavaFX ScrollBar control, a standalone
scrollbar that can be used independently of a scroll pane to control the
position of content within a view. It has a minimum, maximum, and current
value, and reports value changes through an onChange callback. The bar
can be oriented horizontally or vertically, and supports both unit increments
(single arrow-button clicks) and block increments (clicking the track on
either side of the thumb). ScrollBar inherits the full set of Control,
Region, and Node CSS properties for visual customization.
| Pseudo-class | Description |
|---|---|
horizontal |
Applies when the scroll bar orientation is horizontal. |
vertical |
Applies when the scroll bar orientation is vertical. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-orientation |
horizontal | vertical |
horizontal |
Direction in which the scroll bar is drawn. |
-fx-block-increment |
<number> |
10 |
Amount the value changes when the user clicks the track beside the thumb. |
-fx-unit-increment |
<number> |
1 |
Amount the value changes per click on an arrow button. |
| 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 |
false |
When true, the control participates in focus traversal via the keyboard Tab key. Default is false for ScrollBar. |
| 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. |
ScrollBar ()
Creates a new ScrollBar.
setValue (double Val)
Sets the current value.
Val is a double with the value.this object for chaininggetValue ()
Gets the current value.
A double with the value.setMin (double Min)
Sets the minimum value.
Min is a double with the minimum.this object for chainingsetMax (double Max)
Sets the maximum value.
Max is a double with the maximum.this object for chainingsetOrientation (string Orientation)
Sets the orientation.
Orientation is a javafx.geometry.Orientation constant name. Using an fxorient enum value such as fxorient.VERTICAL is recommended over the bare string "VERTICAL", though both work.this object for chainingsetVisibleAmount (double Amount)
Sets the visible amount of the scrollbar thumb relative to the range.
Amount is a double with the visible amount.this object for chainingsetBlockIncrement (double Increment)
Sets the amount the value changes when the user clicks the track beside the thumb.
Increment is a double with the block increment.this object for chainingsetUnitIncrement (double Increment)
Sets the amount the value changes per click on an arrow button.
Increment is a double with the unit increment.this object for chainingsetId (string Id)
Sets the CSS id of this ScrollBar node.
Id is a string with the CSS id.this object for chainingonChange (callback OnChange)
Sets a callback for when the value changes.
OnChange is a callback to call on value change.this object for chaininggetMin ()
Returns the minimum value.
A double with the minimum value.minProperty ()
Returns the DoubleProperty backing the minimum value.
A DoubleProperty AJO.getMax ()
Returns the maximum value.
A double with the maximum value.maxProperty ()
Returns the DoubleProperty backing the maximum value.
A DoubleProperty AJO.valueProperty ()
Returns the DoubleProperty backing the current value.
A DoubleProperty AJO.getOrientation ()
Returns the orientation enum value as a string (HORIZONTAL or VERTICAL).
A string with the orientation name.orientationProperty ()
Returns the ObjectProperty backing the orientation.
An ObjectPropertygetUnitIncrement ()
Returns the unit increment (amount the value changes per arrow click).
A double with the unit increment.unitIncrementProperty ()
Returns the DoubleProperty backing the unit increment.
A DoubleProperty AJO.getBlockIncrement ()
Returns the block increment (amount the value changes when track is clicked).
A double with the block increment.blockIncrementProperty ()
Returns the DoubleProperty backing the block increment.
A DoubleProperty AJO.getVisibleAmount ()
Returns the visible amount of the scrollbar thumb relative to the range.
A double with the visible amount.visibleAmountProperty ()
Returns the DoubleProperty backing the visible amount.
A DoubleProperty AJO.adjustValue (double Position)
Adjusts the current value by a block-increment-sized step toward the given position. The position is interpreted within the min/max range.
Position is a double with the target position.this object for chainingincrement ()
Increments the value by one unit-increment step.
this object for chainingdecrement ()
Decrements the value by one unit-increment step.
this object for chaining
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.