SwingRecomposer
What a composition is driven by: a single Recomposer, the frame clock it recomposes on, and the CoroutineScope they run on. Every content composition nested into one of these recomposes on one recomposer and one frame clock.
Frame-driven work is cadenced to the display the component this was created for is on, and follows that component across displays: a component reports every java.awt.GraphicsConfiguration change, including the ones an ancestor propagates down to it.
Content is mounted on it by passing its compositionContext as the parent of a mount.
It holds a live coroutine scope and a Swing timer, so it has to be disposed. A caller handed one by create owns it and decides when it ends; the one a window is given is this library's own and ends itself once nothing composes under it any more.
A failure ends it too. The runtime records the first throw and recomposes nothing after it - from a recomposition pass, from content's first composition, or from an effect the content launched - so this is disposed as soon as the runtime reports it stopped. A pass or an effect that throws is reported through the thread's uncaught-exception handler once; a first composition's throw reaches whoever composed it. A pass or an effect reports the stop as it happens. A first composition records the failure without deriving anything, so its stop is reported only on the next change reaching the runtime - a state write, or the settlement an input event queues - and content set in between composes once and is torn down with the rest.
Marked InternalSwingUiApi; it may change without notice in any release.
Types
Properties
Functions
Disposes the content compositions registered as composing under this recomposer, then cancels the recomposer, disposes the clock - which is what withdraws it from EventDispatchHook - and cancels the scope they run on. Idempotent.