Class SFrame

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.dialog.Dialog
com.vaadin.swingbridge.surrogates.SWindow
com.vaadin.swingbridge.surrogates.SFrame
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasAriaRole, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.dialog.DialogVariant>, ComponentMixin, ContainerMixin, JComponentMixin, Serializable
Direct Known Subclasses:
SJDialog, SJFrame

public class SFrame extends SWindow
Surrogate for Frame. Extends SWindow (the Window-level peer-sync, owner tree, listener families, lifecycle) and adds the Frame-specific surface: title (mirrored to Dialog.setHeaderTitle(String)), the close-X icon in the Dialog header (Frame chrome — JDK Window has no chrome by default; only Frame and Dialog do), and the AWT-Frame state stubs (state / resizable / undecorated). The JFrame-shaped layer (default close operation, content-pane routing, JRootPane holder) lives on SJFrame.

Owner type

SFrame's owner-taking ctor accepts SFrame owner for backward compatibility (callers existed before SWindow landed). The underlying field is SWindow.owner typed SWindow; SWindow.getOwner() inherits from SWindow and returns SWindow. Tests that assert frame.getOwner() == otherFrame work because the comparison is by reference, not by static type. JDK shape is Frame.getOwner inheriting Window.getOwner returning Window; ours matches.

Add / remove on a bare SFrame

SFrame.add(component) routes through Dialog's default add, which puts the child in the overlay's content slot. There is no intermediate content-pane — JDK Container.add(Component) also adds directly without a content-pane indirection (the contentPane indirection is JFrame's). SJFrame overrides add/remove to route through its own contentPane, matching JFrame's post-Java-5 contract.
See Also:
  • Constructor Details

    • SFrame

      public SFrame()
      Untitled, no owner.
    • SFrame

      public SFrame(String title)
      Titled, no owner. Null title coerces to empty string.
    • SFrame

      public SFrame(SFrame owner)
      Untitled, with owner. Null owner is a top-level frame.
    • SFrame

      public SFrame(String title, SFrame owner)
      Full ctor. Null title coerces to empty; null owner makes this top-level. SWindow's ctor handles owner registration + Dialog peer subscription; SFrame layers title + the close-X chrome on top.
  • Method Details

    • getTitle

      public String getTitle()
      Never-null per AWT contract.
    • setTitle

      public void setTitle(String title)
      AWT's Frame coerces null title to empty string, and getTitle is documented as never-null. Mirrors Dialog.setHeaderTitle(String) on every set; fires "title" PCE.
    • getFrames

      public static List<SFrame> getFrames()
      Every SFrame reachable from the current UI. Filters SWindow.getWindows() by instanceof SFrame.
    • getOwnerlessFrames

      public static List<SFrame> getOwnerlessFrames()
      Subset of getFrames() with owner == null.
    • getState

      public int getState()
      AWT legacy state: NORMAL (0) or ICONIFIED (1). Always NORMAL here.
    • setState

      public void setState(int state)
      WARN on non-NORMAL; silent on NORMAL (redundant set).
    • getExtendedState

      public int getExtendedState()
      Bitmask form of getState(). Always NORMAL — browser tabs don't iconify or maximize in the AWT sense.
    • setExtendedState

      public void setExtendedState(int state)
      WARN on non-NORMAL; silent on NORMAL.
    • isResizable

      public boolean isResizable()
      Whether the end user may resize this frame by dragging its edges. Reads the native Vaadin Dialog.isResizable() — the frame renders as a Dialog overlay, and Vaadin Dialog draws drag-to-resize grips when resizable. Seeded to true in the ctor to match AWT's resizable-by-default Frame/Dialog.
      Overrides:
      isResizable in class com.vaadin.flow.component.dialog.Dialog
    • setResizable

      public void setResizable(boolean b)
      Drive the native Vaadin Dialog.setResizable(boolean) and fire the "resizable" property change java.awt.Frame.setResizable fires. Not a no-op: the "browser resizes the viewport regardless" premise holds for the OS window but not for a frame, which renders as a fixed-size Dialog overlay whose own resize affordance Vaadin exposes right here — honoring the flag keeps a resizable Swing window resizable in the browser.

      Because the effect is fully honoured, there is no R_vaadin_first drop to hide behind: the property is real here, so its notification is owed (SD_property_fanout_audit).

      Overrides:
      setResizable in class com.vaadin.flow.component.dialog.Dialog
    • isUndecorated

      public boolean isUndecorated()
      Vaadin-first read-back of setUndecorated(boolean).
    • setUndecorated

      public void setUndecorated(boolean b)
      Strip (or restore) the window chrome via SWindow.setUndecoratedChrome(boolean) — hides the header (title + close-X), zeroes padding and border radius. Unlike JDK Frame.setUndecorated this doesn't throw when the window is displayable — the CSS class toggles live, so the JDK's not-while-displayable restriction would only add a failure mode we don't have; the displayable-time throw stays on the emulator layer where the JDK contract is the API surface.
    • isDefaultLookAndFeelDecorated

      public static boolean isDefaultLookAndFeelDecorated()
      AWT default: false — JFrames normally use OS-native chrome unless the L&F opts in. We have no L&F layer at all (R_layouts_close_enough) and the Dialog peer always renders Vaadin's overlay chrome, so false is both the honest post-construction answer and the correct one for any code branching on "am I drawing my own chrome?".
    • setDefaultLookAndFeelDecorated

      public static void setDefaultLookAndFeelDecorated(boolean b)
      WARN on true; matches setUndecorated(boolean).
    • paramString

      public String paramString()
      Chain super (SWindow.paramString() = "visible=...") and prepend the title. SJFrame.paramString() extends this with the defaultCloseOperation report.
      Overrides:
      paramString in class SWindow