onSizeChanged
Runs onSizeChanged with the extent the component occupies whenever its size changes.
A child is measured by whatever its parent decides, so this is how the caller who declared the constraints learns what came of them. After the first extent has been reported, a pass that lays the component out at that same extent, or that moves it without resizing it, reports nothing. Declaring this onto a component already placed at a non-zero extent likewise waits for a new extent; an initial zero extent is reported on the first move, resize or show, because it is a valid settled result.
The report arrives on the event dispatch thread after placement, and names the size of the layout bounds: paint outsets, such as a shadow's, make the component's bounds larger and leave this report alone.
Swing's move, resize and show events drive the report, as they do for any Swing component. A change of the layout bounds that keeps the bounds, as when the component leaves a Foundation container, is reported too. A hidden component reports nothing, and a Foundation parent hides a component it measures but does not place. Shown again, it reports only an extent that differs from the last one it reported.
onSizeChanged is read when the report fires, so writing a fresh lambda on every recomposition registers nothing again. Declaring this twice reports twice: each declaration is its own slot.
Return
this chain with the extent report declared on it.
Parameters
receives the extent as its own value, safe to keep.