Skip to content

TextNode

class TextNode
Extends: Node
Package: dev.joid.lib.ui.node.impl.text · Module: core · Source: TextNode.java

Draws a Text in its bounds, and takes the size of the text when no size is declared.

The word Text in light grey, centered on a dark card

The style comes from the Text and its TextInfo; the mode decides how a text wider than the node is shown. The node measures its text in update(), so a layout node sees a change of text on the same frame; an empty or null text gives a size of 0 on each axis that is not declared.

ReturnsSignatureSummary
TextNodecreate(double x, double y) factoryCreates a text node at x, y that takes the width and the height of its text.
TextNodecreate(double x, double y, double width, double height) factoryCreates a text node with a declared size; a size of 0 on an axis takes the size of the text on that axis.
TextNode(double x, double y, double width, double height) protectedCalled by a subclass with the same arguments as create.

PropertyTypeDefaultSummary
text signalTextnullThe text to draw; null draws nothing.
mode signalTextModeTextMode.NORMALHow the text fits the node, see TextMode; with SPLIT, the height follows the lines the text wraps into.
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
voidinit(UI ui) hookMeasures the text when the node loads.
voidupdate() hookMeasures the text on every frame.
voiddraw(double mouseX, double mouseY) hookDraws the text in the bounds and fits the size of the node to what was drawn.
voiddrawSkeleton(double mouseX, double mouseY) hookMeasures the text, then draws the default skeleton at that size.
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

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

TextNode create(double x, double y) factory

Creates a text node at x, y that takes the width and the height of its text.

TextNode create(double x, double y, double width, double height) factory

Creates a text node with a declared size; a size of 0 on an axis takes the size of the text on that axis.

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

Called by a subclass with the same arguments as create.

  • this text(Text text) fluent
  • this text(Supplier<Text> text) fluent signal
  • Text getText()

Default: null

The text to draw; null draws nothing.

  • this mode(TextMode mode) fluent
  • this mode(Supplier<TextMode> mode) fluent signal
  • TextMode getMode()

Default: TextMode.NORMAL

How the text fits the node, see TextMode; with SPLIT, the height follows the lines the text wraps into.

void init(UI ui) hook

Measures the text when the node loads.

void update() hook

Measures the text on every frame.

void draw(double mouseX, double mouseY) hook

Draws the text in the bounds and fits the size of the node to what was drawn.

void drawSkeleton(double mouseX, double mouseY) hook

Measures the text, then draws the default skeleton at that size.


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