RectNode
class RectNode
Extends: Node
Package: dev.joid.lib.ui.node.impl.shape · Module: core · Source: RectNode.java
Draws a filled rectangle on its bounds, with an optional border, and colors that fade on hover.
Description
Section titled “Description”Its size is the width and height of the node; rounded corners, shadows and the other decorations come from effects.
The border properties drive a BorderNodeEffect that the node adds the first time you set one.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
RectNode | create(double x, double y, double width, double height) factory | Creates a rectangle at x, y with this width and height, in design pixels. |
| RectNode(double x, double y, double width, double height) protected | Called by a subclass with the same arguments as create. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| color signal | Color | Color.TRANSPARENT | Fill color of the rectangle. |
| hoveredColor signal | Color | none, the fill keeps color on hover | Fill color while the node is hovered, reached with the hover progress; null keeps the fill unchanged on hover. |
| borderColor signal | Color | Color.TRANSPARENT | Color of the border. |
| hoveredBorderColor signal | Color | none, the border keeps its color on hover | Color of the border while the node is hovered; null keeps the border unchanged on hover. |
| borderStroke signal | double | 0D | Thickness of the border, in design pixels; 0 draws no border. |
| borderCorners signal | boolean | true | If true, the border covers its corners; if false, the corners stay empty. |
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”For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
void | draw(double mouseX, double mouseY) hook | Fills the bounds with the color, blended toward hoveredColor by the hover progress. |
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
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”create
Section titled “create”RectNode create(double x, double y, double width, double height) factory
Creates a rectangle at x, y with this width and height, in design pixels.
RectNode
Section titled “RectNode”RectNode(double x, double y, double width, double height) protected
Called by a subclass with the same arguments as create.
Property details
Section titled “Property details”this color(Color color)fluentthis color(Supplier<Color> color)fluent signalColor getColor()
Default: Color.TRANSPARENT
Fill color of the rectangle. A transparent fill draws nothing but the node can still be hovered and clicked.
hoveredColor
Section titled “hoveredColor”this hoveredColor(Color hoveredColor)fluentthis hoveredColor(Supplier<Color> hoveredColor)fluent signalColor getHoveredColor()
Default: none, the fill keeps color on hover
Fill color while the node is hovered, reached with the hover progress; null keeps the fill unchanged on hover.
borderColor
Section titled “borderColor”this borderColor(Color borderColor)fluentthis borderColor(Supplier<Color> borderColor)fluent signalColor getBorderColor()
Default: Color.TRANSPARENT
Color of the border.
hoveredBorderColor
Section titled “hoveredBorderColor”this hoveredBorderColor(Color hoveredBorderColor)fluentthis hoveredBorderColor(Supplier<Color> hoveredBorderColor)fluent signalColor getHoveredBorderColor()
Default: none, the border keeps its color on hover
Color of the border while the node is hovered; null keeps the border unchanged on hover.
borderStroke
Section titled “borderStroke”this borderStroke(double borderStroke)fluentthis borderStroke(Supplier<Double> borderStroke)fluent signaldouble getBorderStroke()
Default: 0D
Thickness of the border, in design pixels; 0 draws no border.
borderCorners
Section titled “borderCorners”this borderCorners(boolean borderCorners)fluentthis borderCorners(Supplier<Boolean> borderCorners)fluent signalboolean isBorderCorners()
Default: true
If true, the border covers its corners; if false, the corners stay empty.
Method details
Section titled “Method details”void draw(double mouseX, double mouseY) hook
Fills the bounds with the color, blended toward hoveredColor by the hover progress.
A subclass that overrides it calls super.draw(...) to keep the fill.
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
