Class Panel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class Panel extends Container implements Accessible
Emulator for Panel — AWT's generic on-screen container, not JPanel. Peers over a plain Vaadin <div> (inherited from Container), which is what every built-in LayoutManager needs: the CSS emitters refuse to write to a non-<div> host.
Panel form = new Panel(new BorderLayout(8, 4));
form.add(new Label("Name"), BorderLayout.NORTH);
form.add(field, BorderLayout.CENTER);
outer.add(form);                 // FlowLayout by default on `outer`

Everything a migrator calls on a Panel is inherited Container: add and its four overloads, remove / removeAll, setLayout / getLayout, getComponent(int) / getComponents() / getComponentCount(), getInsets, validate / doLayout / invalidate, isAncestorOf, Z-order, and ContainerListener — which this layer fires for real, unlike a pure-surrogate container (SD_listeners_without_analog).

There is deliberately no SPanel surrogate: subtract SJPanel's Swing half (border, opaque, client properties, L&F) and nothing is left for one to hold — the child list belongs to Vaadin's HasComponents, the layout manager to LayoutStore. Per SD_no_spanel this is CLAUDE.md's group-2 shape (a structural shell on a bare Vaadin element), the carve-out against D_surrogate_first's surrogate-first default.

Leaf peer is locked down per R_leaf_peer_lockdown. java.applet.Applet is java.awt.Panel's only JDK subclass, and applets are permanently out of scope (R_match_swing_errors sub-bucket (b)) — the JDK classes are removed in Java 26 per JEP 504, so unlike javax.swing.plaf this subclass cannot come back as future non-leaf pressure. Both ctors funnel through super(), so every instance — including a user-code subclass — peers over a Div and no ctor offers a peer seam.

A layout installed after the Panel is on screen does not take effect until validate() / revalidate(), matching AWT — setLayout only invalidates. The outgoing manager's CSS *is* dropped at setLayout, so the un-revalidated interval renders as plain block flow rather than the old layout's; see Container#setLayout.

See Also:
  • Constructor Details

    • Panel

      public Panel()
      JDK chains this to this(new FlowLayout()) — centered, 5px gaps.
    • Panel

      public Panel(LayoutManager layout)
      Parameters:
      layout - null is legal and installs no manager, exactly as in AWT — children then render in the peer <div>'s default block flow and getLayout() returns null. Do not substitute a FlowLayout here.
  • Method Details