GlassPane
Declares the glass pane of the window whose content this is composed in.
This is declared on WindowScope, the receiver of the content of a Window and of a Dialog, so it is only available where there is a window to carry the pane.
A glass pane is the sheet above everything else in the window: it covers the whole window, it is transparent where content paints nothing, and while it is shown the window's mouse events reach it - which is what makes it the place for a drag-and-drop hint, a progress veil, or anything else drawn over the window rather than in it. content fills the pane, so a layout composable inside it places what the overlay is made of:
Window(onCloseRequest = ::exitApplication) {
if (loading) {
GlassPane {
GridBagPanel {
item { ProgressBar(value = 0, indeterminate = true) }
}
}
}
Editor()
}The content shares the surrounding composition, so it shows the current state the way any other composable does. The pane is over the window for as long as this is in the composition; once this leaves, the window carries the glass pane it carried before, showing it as it was shown - so an overlay that comes and goes is an ordinary if around the call.
A window carries one glass pane, so one declaration serves a window: put the choice of overlay inside the declaration rather than composing a second one for the same window, which fails and leaves the window the pane it carried.
Parameters
the composable content the glass pane shows over the window.