onPlaced

Runs onPlaced with the bounds the component occupies in its parent whenever those bounds change.

This is onSizeChanged's counterpart for where a parent put the child rather than how large it made it, and it reports a resize as well, since a resize is a placement too. After the first bounds have been reported, a pass that lays the component out where it already stood reports nothing, and neither does an ancestor moving: the bounds are stated in the parent's coordinates, which a move further up does not change.

The report arrives on the event dispatch thread after placement, and names the layout bounds in the parent's layout coordinates: those of the parent's layout bounds under a Foundation container, and its Swing coordinates under any other parent. Paint outsets, such as a shadow's, move the component's bounds and leave this report alone.

Swing's move, resize and show events drive the report, as they drive onSizeChanged. Shown again, the component reports its bounds again.

Return

this chain with the placement report declared on it.

Parameters

onPlaced

receives the bounds as their own value, safe to keep.

See also