ConstrainedPanel
A Swing component that measures and places Foundation content by a MeasurePolicy: the component Layout, Row, Column and Box each build, and the way to host Foundation content in a Swing tree you build yourself. Give it content with setContent.
Under a Foundation parent it is measured with the constraints that parent offers.
It installs no UI delegate. It is transparent by default and paints its background itself when opaque. When it holds one Scrollable child and is the view of a JScrollPane, it scrolls by that child's rows or lines.
Its policy reads are tracked only while a node of a Compose composition holds it: Layout, org.jetbrains.compose.swing.node.SwingNode or setContent declares it. Reads for children added with add are not tracked.
A stock parent reads a preferred or minimum size without offering constraints. The preferred size comes from MeasurePolicy.preferredSize and the minimum size from the policy's intrinsic functions. A preferred or minimum size set on the panel replaces the policy's result for that read.
A layer a policy places a child with takes effect on a panel no node holds, which then revalidates nothing.
Constructors
Properties
The lines the last measure provided; none where a set preferred size supplied it.
The height the last measure settled on.
The width the last measure settled on.
The decoration this component paints through; Decoration.None until the library writes one.
Functions
The one scrollable child's answer plus this panel's insets, so a border or a shadow around it is not clipped.
Whether the panel is laid out at the viewport's height; see getScrollableTracksViewportWidth.
Whether the panel is laid out at the viewport's width: where its content asks for that, and where the viewport is wider than the panel asks to be, which is the stretch a pane gives a view that is no Scrollable.
The smallest height beyond which a taller height never makes the width smaller, at width, or at an unbounded width where it is Constraints.Infinity.
The smallest width beyond which a wider width never makes the height smaller, at height, or at an unbounded height where it is Constraints.Infinity.
Measures this panel under constraints. A preferred size set on the panel is the result, as it is for getPreferredSize(); the policy measures only where none is set.
The smallest height at which the content paints correctly at width, or at an unbounded width where it is Constraints.Infinity.
A minimum size set on the panel is the min intrinsic width, and a preferred size set is the max intrinsic width, as they are for getMinimumSize() and getPreferredSize(). Otherwise the policy's intrinsic functions return the result, inside the border insets.
Gathers the decoration the nodes declare and writes it to decoration. Not to be overridden.
Sets the composable content of this panel as JComponent.setContent does. The content is laid out by the panel's MeasurePolicy and reads ConstrainedScope, so layout modifiers declared at its top level, such as fillMaxWidth, padding or aspectRatio, apply against the panel as they do inside a Layout.
Accepts only the layout manager the panel builds from its MeasurePolicy.