Class Box.Filler

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Enclosing class:
Box

public static class Box.Filler extends JComponent implements Accessible
Emulator for Box.Filler. Invisible JComponent sized by its min/pref/max dimensions, used as the implementation of Box's static glue/strut/rigid-area factories. R_leaf_peer_lockdown-locked-down on a Div peer.

CSS strategy at construction (and on changeShape(Dimension, Dimension, Dimension)):

  • Glue (pref == (0,0) with at least one max dimension at Short.MAX_VALUE): write flex-grow: 1. Container's main-axis direction determines whether it grows horizontally or vertically — the canonical pattern (horizontal glue in a row Box, vertical glue in a column Box) gives the expected JDK behaviour.
  • Strut (one pref dimension non-zero, the other zero): write the non-zero dimension as a fixed pixel size plus flex-shrink: 0 so the strut doesn't collapse under container pressure.
  • Rigid area (both pref dimensions non-zero): both fixed dimensions plus flex-shrink: 0.

Cross-axis-glue caveat. A horizontal glue dropped into a Y_AXIS container still gets flex-grow: 1 and so will grow vertically rather than do nothing — JDK behavior is "no growth in cross axis." Small visual divergence under R_layouts_close_enough; canonical usage (matched-axis glue) renders correctly.

See Also: