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
Whether a change of the content's pixels changes what this decorator paints only within the changed area grown by outsets, with the content painted at its own coordinates; false by default.
Draw nodes have fixed decoration metadata and request their own repaint when their drawing changes.
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.
Makes every layer of this node, and of each step declared before it, record on its next draw. On a node with no layer from obtainImageLayer, it makes every layer of the component record. Requests no repaint.
Asks for a paint that draws every layer of this node again with the properties now set on it, as a layer property change does. That paint also shows the repaints of the component's children requested before the call.
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 and releases the layers obtainImageLayer made. 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.