Skip to content

BaseCheckboxNode

abstract class BaseCheckboxNode
Extends: Node
Known subtypes: CheckboxNode
Package: dev.joid.lib.ui.node.impl.control.checkbox · Module: core · Source: BaseCheckboxNode.java

The behavior of a checkbox without its look: a boolean that a left press on the node toggles.

Extend CheckboxNode for a look made of a box and a mark; extend BaseCheckboxNode only to build the look entirely yourself. The value follows the pattern of every control: a start value, a signal bound both ways, change(...), beforeChange and onChange.

ReturnsSignatureSummary
BaseCheckboxNode(double x, double y, double width, double height) protectedCreates the checkbox at x, y with a width and a height in design pixels, from the constructor of a skin.

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

ReturnsSignatureSummary
Tchecked(boolean checked)Gives the checkbox its start value; the box shows it, and a box attached already fires onChange when it differs.
Tchecked(Signal checked)Binds the value to a signal both ways: the box shows the signal, and a press writes the new value into it.
thischange(boolean checked) fluentSets the value as if the user pressed the box: beforeChange can refuse it, then onChange fires.
TbeforeChange(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)Adds a listener that runs before a change that a press or change(...) asks for, with the value now and the value asked for; cancel() refuses it.
booleanisChecked()If true, the box is checked.
ReturnsSignatureSummary
voidmousePressed(NodeMouseEvent<?> event) hookToggles the value on a left press over the box that no one consumed, and consumes the press.
Inherited from Node (128)

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 · isDragging · 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

EventListenerSummary
onChangeEventListener<NodeChangeEvent.Post<T,Boolean>>Adds a listener that runs after each real change of the value, whatever its source.
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

BaseCheckboxNode(double x, double y, double width, double height) protected

Creates the checkbox at x, y with a width and a height in design pixels, from the constructor of a skin.

<T extends BaseCheckboxNode> T checked(boolean checked)

Gives the checkbox its start value; the box shows it, and a box attached already fires onChange when it differs. A setter is never refused.

<T extends BaseCheckboxNode> T checked(Signal<Boolean> checked)

Binds the value to a signal both ways: the box shows the signal, and a press writes the new value into it. Throws an IllegalArgumentException for a signal that cannot be written, such as a derived value.

this change(boolean checked) fluent

Sets the value as if the user pressed the box: beforeChange can refuse it, then onChange fires.

<T extends BaseCheckboxNode> T beforeChange(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)

Adds a listener that runs before a change that a press or change(...) asks for, with the value now and the value asked for; cancel() refuses it.

boolean isChecked()

If true, the box is checked.

void mousePressed(NodeMouseEvent<?> event) hook

Toggles the value on a left press over the box that no one consumed, and consumes the press.

<T extends BaseCheckboxNode> T onChange(EventListener<NodeChangeEvent.Post<T,Boolean>> listener)

Adds a listener that runs after each real change of the value, whatever its source. It does not run for a value equal to the current one.


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

Report a problem with this page