Skip to content

ScrollBar

Draggable scrollbar control for scrolling content along horizontal or vertical axes.

Overview

ScrollBar extends Box to render an animated track and draggable thumb. Supports smooth hover expansion, wheel steps, discrete page jumps, and change event subscriptions.

Vertical ScrollBar

ScrollBar scroll = new ScrollBar()
        .orientation(Orientation.VERTICAL)
        .range(0.0f, 500.0f)
        .pageSize(50.0f)
        .value(0.0f);
scroll.onValueChanged(e -> list.scrollOffset(e.newValue()));

API

ScrollBar::dragging()

Is Dragging

Returns whether scrollbar thumb is actively dragged.

Returns boolean.

ScrollBar::hoverThickness()

Get Hover Thickness

Returns expanded scrollbar thickness when hovered.

Returns float.

ScrollBar::hoverThickness(float)

Set Hover Thickness

Sets expanded scrollbar thickness when hovered.

Parameter Type Description
hoverThickness float —

Returns ScrollBar.

ScrollBar::idleThickness()

Get Idle Thickness

Returns scrollbar thickness when not hovered.

Returns float.

ScrollBar::idleThickness(float)

Set Idle Thickness

Sets scrollbar thickness when not hovered.

Parameter Type Description
idleThickness float —

Returns ScrollBar.

ScrollBar::max()

Get Maximum

Returns scroll upper bound.

Returns float.

ScrollBar::max(float)

Set Maximum

Sets scroll upper bound.

Parameter Type Description
max float —

Returns ScrollBar.

ScrollBar::min()

Get Minimum

Returns scroll lower bound.

Returns float.

ScrollBar::min(float)

Set Minimum

Sets scroll lower bound.

Parameter Type Description
min float —

Returns ScrollBar.

ScrollBar::onValueChanged(EventListener)

On Value Changed

Registers event listener for scroll offset changes.

Parameter Type Description
listener EventListener —

Returns EventSubscription.

ScrollBar::orientation()

Get Orientation

Returns current scrollbar axis orientation.

Returns Orientation.

ScrollBar::orientation(Orientation)

Set Orientation

Configures scrollbar axis orientation (HORIZONTAL or VERTICAL).

Parameter Type Description
orientation Orientation —

Returns ScrollBar.

ScrollBar::pageSize()

Get Page Size

Returns viewport page size used to calculate thumb proportion.

Returns float.

ScrollBar::pageSize(float)

Set Page Size

Sets viewport page size.

Parameter Type Description
pageSize float —

Returns ScrollBar.

ScrollBar::range(float, float)

Set Range

Sets both lower and upper scroll boundaries.

Parameter Type Description
min float —
max float —

Returns ScrollBar.

ScrollBar::silentValue(float)

Set Silent Value

Sets scroll offset value without firing change listeners.

Parameter Type Description
value float —

Returns ScrollBar.

ScrollBar::step()

Get Step

Returns step distance per scroll increment.

Returns float.

ScrollBar::step(float)

Set Step

Sets step distance per scroll increment.

Parameter Type Description
step float —

Returns ScrollBar.

ScrollBar::thumbColor()

Thumb Color

Returns mutable thumb color in resting state.

Returns MutableColor.

ScrollBar::thumbHoverColor()

Hover Thumb Color

Returns mutable thumb color when hovered.

Returns MutableColor.

ScrollBar::trackColor()

Track Color

Returns mutable track background color.

Returns MutableColor.

ScrollBar::value()

Get Value

Returns current scroll offset value.

Returns float.

ScrollBar::value(float)

Set Value

Sets scroll offset value clamped to valid range.

Parameter Type Description
value float —

Returns ScrollBar.