decoration

Declares decorator on a component that paints through a decoration: a component implementing Decoratable. Any other component is refused, with an IllegalStateException naming Decoratable.

Every decorator a chain declares is kept, in declaration order, rather than the last one winning: SwingModifier.decoration(a).decoration(b) paints a around b. A declaration whose decorator is equal across a recomposition leaves the component's painting alone; a change in the component's paint outsets has its Foundation container fit its bounds around its layout bounds, as well as repainting it.

decorator paints at its decorated box: the box of the first layout modifier declared after it, such as a padding, or the component's layout bounds when none follows.

Return

this chain with the decorator declared on it.

Parameters

decorator

what wraps the component's painting inside everything declared before it.


Declares element, whose DecorationModifierNode is one step of the component's decoration, such as a DrawModifierNode. It paints at its place among the other steps, as a declared Decorator does, so the component must be a Decoratable and element must be additive; either is refused, before the node attaches when element names Decoratable as its target type, or as the node attaches otherwise.

Return

this chain with the step declared on it.

Parameters

element

the step to declare, creating the node that paints it.