BaseScrollbarNode
abstract class BaseScrollbarNode
Extends: Node
Known subtypes: ScrollbarNode
Package: dev.joid.lib.ui.node.impl.control.scrollbar · Module: core · Source: BaseScrollbarNode.java
The behavior of a scrollbar without its look: it reads the scroll of the node it serves and scrolls it when the user drags along the bar.
Description
Section titled “Description”Give a scrollbar to a node with Node.scrollbar, never with attach: the node becomes its parent and the bar serves it.
The bar is horizontal when it is wider than high, and vertical otherwise.
A left press on the thumb grabs it where it was pressed; a press elsewhere on the bar centers the thumb on the pointer; a drag then scrolls the node.
Use ScrollbarNode for a look made of a track and a thumb.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| BaseScrollbarNode(double x, double y, double width, double height) protected | Creates the bar at x, y with a width and a height in design pixels, relative to the node it serves, from the constructor of a skin. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| scrollNode | Node | null | The node that the bar scrolls; Node.scrollbar sets it. |
| minThumb signal | double | 0D | The smallest length of the thumb, in design pixels, so that a long content keeps a thumb large enough to grab. |
Inherited from Node (24)
x · y · width · height · position · anchor · anchorX · anchorY · aspectRatio · zindex · zlevel · skeleton · visible · enabled · interactive · cursor · hoverDuration · hoverEquation · hover · overflow · scrollSpeed · scrollbar · label · draggable
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
boolean | isHorizontal() | If true, the bar is wider than high: it then scrolls the node horizontally. |
boolean | isOverflowing() | If true, the content of the node goes beyond it on the axis of the bar. |
double | getRatio() | Returns the part of the content that the node shows on the axis of the bar, from 0D to 1D; 1D while the content fits. |
double | getProgress() | Returns how far the node scrolled on the axis of the bar, from 0D at the start to 1D at the end; during a drag, the offset that the node glides to, so the thumb stays in place when a beforeScroll listener refuses the scroll. |
double | getThumbLength() | Returns the length of the thumb, in design pixels: the length of the bar times getRatio(), at least minThumb and at most the bar. |
boolean | isDragging() | If true, the user drags the bar. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
void | drawSkeleton(double mouseX, double mouseY) hook | Draws the bar as usual while its content waits, instead of a skeleton. |
void | mousePressed(NodeMouseEvent<?> event) hook | On a left press over the bar that no one consumed, starts the drag, scrolls the node to the pointer and consumes the press. |
void | mouseReleased(NodeMouseEvent<?> event) hook | Ends the drag on the release of the left button. |
void | mouseDragged(NodeMouseEvent<?> event) hook | Scrolls the node so that the thumb follows the pointer during the drag. |
void | detach() hook | Ends a drag in progress when the bar leaves the tree. |
Inherited from Node (127)
load · render · renderHover · updateScroll · updateScrollX · updateScrollY · append · attach · body · clearChildren · getChild · getChildren · getNodeListAt · getParent · isAttached · getAbsoluteX · getAbsoluteY · getAbsoluteDefaultX · getAbsoluteDefaultY · toDrawX · toDrawY · w · h · dw · dh · mw · mh · aw · ah · ax · ay · getDefaultWidth · getDefaultHeight · removeHover · clearHover · refreshHover · getResolvedCursor · hoverValue · getHoverAnimator · isHovered · handleMousePressed · handleMouseReleased · handleMouseDragged · handleMouseScroll · handleCharTyped · handleKeyPressed · handleKeyReleased · getLastClickTime · getLastClickButton · getLastKey · getLastKeyTime · scrollX · scrollY · scrollTo · beforeScroll · hasOverflowX · hasOverflowY · getOverflowArea · getScrollX · getScrollY · getTargetScrollX · getTargetScrollY · getMaxScrollX · getMaxScrollY · isScrollEndX · isScrollEndY · startDragging · stopDragging · beforeDragStart · beforeDragDrop · getDragX · getDragY · isDragged · getDragSource · getDraggedNode · getStartDragX · getStartDragY · getTargetDragX · getTargetDragY · effect · removeEffect · clearEffects · hasEffect · getEffect · layer · clearLayers · animate · removeAnimator · wait · watch · hasListener · isVisibleProperty · isMounted · getIndex · getUi · getHierarchy · getMappedIndex · getTaskList · getShortcutList · toJson · toString · getEventBus · getBodyConsumer · getDefaultX · getDefaultY · getLayoutX · getLayoutY · getShiftX · getShiftY · isStepping · getLastCodepoint · getLoadCount · getRenderTime · remove · self · copy · useStore · addTask · removeTask · addShortcut · removeShortcut · layoutPosition · layoutSize · fit · move · beforeMove · hoverColor
Events
Section titled “Events”Inherited from Node (21)
onUpdate · onDetach · onInit · onRender · onDraw · onMount · onHoverStart · onHover · onHoverEnd · onScroll · onScrollToEnd · onScrollEndReached · onDragStart · onDrag · onDragDrop · onDragSnap · onMove · onChildAppend · onClick · onAnimate · onWatch
Creation details
Section titled “Creation details”BaseScrollbarNode
Section titled “BaseScrollbarNode”BaseScrollbarNode(double x, double y, double width, double height) protected
Creates the bar at x, y with a width and a height in design pixels, relative to the node it serves, from the constructor of a skin.
Property details
Section titled “Property details”scrollNode
Section titled “scrollNode”this scrollNode(Node scrollNode)fluentNode getScrollNode()
Default: null
The node that the bar scrolls; Node.scrollbar sets it.
A bar attached without one throws an IllegalStateException.
minThumb
Section titled “minThumb”this minThumb(double minThumb)fluentthis minThumb(Supplier<Double> minThumb)fluent signaldouble getMinThumb()
Default: 0D
The smallest length of the thumb, in design pixels, so that a long content keeps a thumb large enough to grab.
Method details
Section titled “Method details”isHorizontal
Section titled “isHorizontal”boolean isHorizontal()
If true, the bar is wider than high: it then scrolls the node horizontally.
isOverflowing
Section titled “isOverflowing”boolean isOverflowing()
If true, the content of the node goes beyond it on the axis of the bar.
getRatio
Section titled “getRatio”double getRatio()
Returns the part of the content that the node shows on the axis of the bar, from 0D to 1D; 1D while the content fits.
getProgress
Section titled “getProgress”double getProgress()
Returns how far the node scrolled on the axis of the bar, from 0D at the start to 1D at the end; during a drag, the offset that the node glides to, so the thumb stays in place when a beforeScroll listener refuses the scroll.
getThumbLength
Section titled “getThumbLength”double getThumbLength()
Returns the length of the thumb, in design pixels: the length of the bar times getRatio(), at least minThumb and at most the bar.
isDragging
Section titled “isDragging”boolean isDragging()
If true, the user drags the bar.
drawSkeleton
Section titled “drawSkeleton”void drawSkeleton(double mouseX, double mouseY) hook
Draws the bar as usual while its content waits, instead of a skeleton.
mousePressed
Section titled “mousePressed”void mousePressed(NodeMouseEvent<?> event) hook
On a left press over the bar that no one consumed, starts the drag, scrolls the node to the pointer and consumes the press.
mouseReleased
Section titled “mouseReleased”void mouseReleased(NodeMouseEvent<?> event) hook
Ends the drag on the release of the left button.
mouseDragged
Section titled “mouseDragged”void mouseDragged(NodeMouseEvent<?> event) hook
Scrolls the node so that the thumb follows the pointer during the drag.
detach
Section titled “detach”void detach() hook
Ends a drag in progress when the bar leaves the tree.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
