DrawModifierNode
A SwingModifier.ComponentNode that draws into its component.
It is a DecorationModifierNode whose paint runs draw: the component must be Decoratable, and draw nodes and decorations run in the order the modifier declares them. The element declaring a draw node is additive, and a child declares it through decoration.
Snapshot state read in draw is observed: a change to it repaints the component, without laying it out again.
Properties
Functions
Draws this node on the event dispatch thread. ContentDrawScope.size is the size of this node's decorated box.
Repaints this node's component, so DrawModifierNode.draw runs again. Does nothing while it is not attached.
Whether this decorator needs the component's paint bounds worked out, through paintBounds, while no visible child has an edge past the layout bounds and no decorator has outsets; true by default. A child with an edge past the layout bounds, or a decorator with outsets, has them worked out whatever this answers. Return false only when this decorator, in a box of width by height, cannot enlarge a box-sized content's paint bounds beyond its outsets.
Refuses an element that is not additive. An element naming Decoratable as its target type is refused before this node is created; otherwise this node is refused if the component is not a Decoratable.
Runs onRemovedFromDecoration. The component is handed the decoration without this step once the modifier pass ends.
Called before the next draw once the size this node draws in has changed, and before the first one.
Runs draw, with ContentDrawScope.drawContent painting content.
The area this decorator and its content can paint, in a box of width by height. The default includes the box and the content's bounds, grown by outsets. Override this when painting, clipping, or transforming content changes that area. The returned shape reserves paint space, not a clip. It also decides hit testing past the layout bounds: a press there reaches a child only where the paint bounds of a one-pixel content at the point cover the point.