Skip to content

INode

interface INode
Extends: IIndexedElement
Known subtypes: Node
Package: dev.joid.lib.ui.node · Module: core · Source: INode.java

The hooks that JOID calls on a node, all empty by default, that a node of your own overrides.

Node implements it; override only the hooks you need, and call super to keep the behavior of a built-in node. Every hook runs on the render thread.

ReturnsSignatureSummary
voidinit(UI ui) hook defaultCalled when the node is loaded into a UI, after its children and its effects and before onInit.
voidupdate() hook defaultCalled on every frame, after the children are updated and before the node is drawn.
voidlayout() hook defaultCalled on every frame, after the node is placed and before its children are drawn: place the children and the parts here with layoutPosition and layoutSize.
voiddraw(double mouseX, double mouseY) hook defaultDraws the node at getX(), getY(), with the mouse at this point of the canvas, once it is mounted.
voiddrawSkeleton(double mouseX, double mouseY) hook defaultDraws the node in place of draw while one of its wait conditions fails and it has no skeleton node.
voidmousePressed(NodeMouseEvent<?> event) hook defaultCalled when a mouse press reaches the node, after its handleMousePressed listeners.
voidmouseReleased(NodeMouseEvent<?> event) hook defaultCalled when a mouse release reaches the node.
voidmouseDragged(NodeMouseEvent<?> event) hook defaultCalled when the mouse moves with a button held.
voidmouseScroll(NodeMouseScrollEvent<?> event) hook defaultCalled when a wheel turn reaches the node, after the node has scrolled its own content.
voidcharTyped(NodeCharEvent<?> event) hook defaultCalled when a typed character reaches the node.
voidkeyPressed(NodeKeyEvent<?> event) hook defaultCalled when a key press reaches the node.
voidkeyReleased(NodeKeyEvent<?> event) hook defaultCalled when a key release reaches the node.
voiddetach() hook defaultCalled when the node leaves its UI, after its children: release here what init started.

void init(UI ui) hook default

Called when the node is loaded into a UI, after its children and its effects and before onInit.

void update() hook default

Called on every frame, after the children are updated and before the node is drawn. Measure a size that depends on the content here, so that a layout node sees it on the same frame.

void layout() hook default

Called on every frame, after the node is placed and before its children are drawn: place the children and the parts here with layoutPosition and layoutSize.

void draw(double mouseX, double mouseY) hook default

Draws the node at getX(), getY(), with the mouse at this point of the canvas, once it is mounted.

void drawSkeleton(double mouseX, double mouseY) hook default

Draws the node in place of draw while one of its wait conditions fails and it has no skeleton node.

void mousePressed(NodeMouseEvent<?> event) hook default

Called when a mouse press reaches the node, after its handleMousePressed listeners. The event can already be consumed: check it before acting.

void mouseReleased(NodeMouseEvent<?> event) hook default

Called when a mouse release reaches the node.

void mouseDragged(NodeMouseEvent<?> event) hook default

Called when the mouse moves with a button held.

void mouseScroll(NodeMouseScrollEvent<?> event) hook default

Called when a wheel turn reaches the node, after the node has scrolled its own content.

void charTyped(NodeCharEvent<?> event) hook default

Called when a typed character reaches the node.

void keyPressed(NodeKeyEvent<?> event) hook default

Called when a key press reaches the node.

void keyReleased(NodeKeyEvent<?> event) hook default

Called when a key release reaches the node.

void detach() hook default

Called when the node leaves its UI, after its children: release here what init started. A detach that throws prints a warning, and the node is detached anyway.


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