Class Box

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class Box extends JComponent implements Accessible
Emulator for Box. Container with a pre-installed BoxLayout plus static factories producing the canonical Box.Filler components migrators reach for: horizontal/vertical glue, struts, and rigid areas.

R_leaf_peer_lockdown-locked-down — JDK Box is a leaf in the public javax.swing.* hierarchy. Peer is a plain Div; the protected (Component peer) ctor is omitted so user-code subclasses inherit the locked Div peer.

Emulator-only — no SBox surrogate by SD_no_sjoptionpane-shape carve-out (the JOptionPane "no surrogate by design" precedent). Pure-surrogate users have no use for Box: Vaadin's VerticalLayout / HorizontalLayout cover the same ground without the JDK ergonomic lift.

setLayout(LayoutManager) throws. JDK Box always throws AWTError from setLayout — the layout is fixed at construction time and the ctor bypasses via super.setLayout. R_match_swing_errors: we match the same throw, same message.

See Also:
  • Constructor Details

    • Box

      public Box(int axis)
  • Method Details

    • setLayout

      public void setLayout(LayoutManager l)
      JDK Box.setLayout unconditionally throws AWTError to signal "use the layout the ctor installed." R_match_swing_errors — match the same exception type and message.
      Overrides:
      setLayout in class Container
    • createHorizontalBox

      public static Box createHorizontalBox()
    • createVerticalBox

      public static Box createVerticalBox()
    • createHorizontalGlue

      public static Component createHorizontalGlue()
    • createVerticalGlue

      public static Component createVerticalGlue()
    • createGlue

      public static Component createGlue()
    • createHorizontalStrut

      public static Component createHorizontalStrut(int width)
    • createVerticalStrut

      public static Component createVerticalStrut(int height)
    • createRigidArea

      public static Component createRigidArea(Dimension d)
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()
      Specified by:
      getAccessibleContext in interface Accessible
      Overrides:
      getAccessibleContext in class Component