LocalWindow

val LocalWindow: CompositionLocal<Window?>

The owning AWT Window of the current subtree.

Every composition the library roots in a window carries it: the javax.swing.JFrame or javax.swing.JDialog behind a composed Window or Dialog, and the window a setContent content composition is attached to. A composition nested in another inherits the value of the one it joins. The window its own container hangs in answers only where that composition names none, so content composed away from any window (a list cell renderer's rows, a menu shown from a popup) keeps reading the window it was composed under rather than whichever transient peer it is painted into.

This is the parent to hand plain Swing API that needs one - JFileChooser, JOptionPane - and the window to bring to the front or query for its screen.

Content given a caller's own composition to compose under, before its container is added anywhere, reads null until that container reaches a window. It reads that window from then on, without being composed again.

The value is null wherever the content stands in no window at all, such as a bare application { } scope that has created none.