Class JInternalFrame

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, WindowConstants, FieldReconciler.Reconcilable, RootPaneContainer

public class JInternalFrame extends JComponent implements Accessible, WindowConstants, FieldReconciler.Reconcilable, RootPaneContainer
Emulator for JInternalFrame. R_leaf_peer_lockdown-locked peer is SJInternalFrame.
See Also:
  • Field Details

  • Constructor Details

    • JInternalFrame

      public JInternalFrame()
    • JInternalFrame

      public JInternalFrame(String title)
    • JInternalFrame

      public JInternalFrame(String title, boolean resizable)
    • JInternalFrame

      public JInternalFrame(String title, boolean resizable, boolean closable)
    • JInternalFrame

      public JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable)
    • JInternalFrame

      public JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)
  • Method Details

    • reconcileFields

      public final void reconcileFields()
      D_field_write_reconcile repair hook — see JSlider.reconcileFields().
      Specified by:
      reconcileFields in interface FieldReconciler.Reconcilable
    • frameInit

      protected void frameInit()
      Mirror of JDK JInternalFrame construction: plant the emulator-side content pane with rootPaneCheckingEnabled=false so super.addImpl falls through to Container.addImpl, then flip checking on and wire the peer→emulator event relay.
    • createContentPane

      protected Container createContentPane()
    • getContentPane

      public Container getContentPane()
      Specified by:
      getContentPane in interface RootPaneContainer
    • setContentPane

      public void setContentPane(Container newPane)
      Specified by:
      setContentPane in interface RootPaneContainer
    • addImpl

      protected void addImpl(Component comp, Object constraints, int index)
      Overrides:
      addImpl in class Container
    • setLayout

      public void setLayout(LayoutManager manager)
      Overrides:
      setLayout in class Container
    • remove

      public void remove(Component comp)
      Overrides:
      remove in class Container
    • setRootPaneCheckingEnabled

      protected void setRootPaneCheckingEnabled(boolean enabled)
      Companion to isRootPaneCheckingEnabled(): every internal write to the flag goes through here, so a subclass override observes the suspend / restore that brackets a content-pane swap as it does on the desktop.
    • isRootPaneCheckingEnabled

      protected boolean isRootPaneCheckingEnabled()
      Whether add / remove / setLayout redirect into the content pane. The redirect consults this method rather than the field, so a subclass override is honoured (R_no_vaadin_in_api second limb, D_r12_provenance).
    • getRootPane

      public JRootPane getRootPane()
      Specified by:
      getRootPane in interface RootPaneContainer
      Overrides:
      getRootPane in class JComponent
    • setRootPane

      protected void setRootPane(JRootPane newRootPane)
      The JDK also re-parents the pane through remove / add under a suspended root-pane check; that half is R_layouts_close_enough layout and stays out. The "rootPane" fire is not (D_owed_events).
    • createRootPane

      protected JRootPane createRootPane()
    • getLayeredPane

      public JLayeredPane getLayeredPane()
      Specified by:
      getLayeredPane in interface RootPaneContainer
    • setLayeredPane

      public void setLayeredPane(JLayeredPane layered)
      Specified by:
      setLayeredPane in interface RootPaneContainer
    • getGlassPane

      public Component getGlassPane()
      Specified by:
      getGlassPane in interface RootPaneContainer
    • setGlassPane

      public void setGlassPane(Component glass)
      Specified by:
      setGlassPane in interface RootPaneContainer
    • setVisible

      public void setVisible(boolean b)
      A JInternalFrame's peer is a Dialog overlay, so visibility means open/close, not display toggling. Drive the peer's SWindow.setVisible(boolean) (which attaches + opens the overlay and fires INTERNAL_FRAME_OPENED via the relay on first show) and track our own field, since JComponent's visible field lives in another package and defaults to true.
      Overrides:
      setVisible in class JComponent
    • isVisible

      public boolean isVisible()
      Overrides:
      isVisible in class Component
    • isShowing

      public boolean isShowing()

      All three conjuncts are the JDK's, measured: a visible frame added nowhere, and a visible frame on a desktop that is in no window, both answer false on JDK 25.

      AWT's inherited body cannot serve, for two independent reasons. It reads Component.visible, which is package-private to vaadinx.awt, so this class carries frameVisible instead and the inherited body would read a true nobody wrote. And its parent walk has nothing to walk: per D_jdesktoppane_holder the frame escapes to its own overlay rather than becoming the desktop's child, so it is never displayable and AWT's body would refuse every setSelected(boolean).

      Overrides:
      isShowing in class Component
    • getDesktopPane

      public JDesktopPane getDesktopPane()
      Returns:
      the desktop this frame was added to, or null if none. The JDK finds it by walking parents and falls back to searching from the desktop icon; neither works here (D_jdesktoppane_holder), so it is recorded on the way in instead.
    • setLocation

      public void setLocation(int x, int y)
      Overrides:
      setLocation in class Component
    • setLocation

      public void setLocation(Point p)
      Overrides:
      setLocation in class Component
    • setSize

      public void setSize(int width, int height)
      Overrides:
      setSize in class Component
    • setSize

      public void setSize(Dimension d)
      Overrides:
      setSize in class Component
    • setBounds

      public void setBounds(int x, int y, int width, int height)
      Overrides:
      setBounds in class Component
    • setBounds

      public void setBounds(Rectangle r)
      Overrides:
      setBounds in class Component
    • getLocation

      public Point getLocation()
      Overrides:
      getLocation in class Component
    • getSize

      public Dimension getSize()
      Overrides:
      getSize in class Component
    • isClosed

      public boolean isClosed()
    • setClosed

      public void setClosed(boolean b) throws PropertyVetoException
      Constrained property. Fires the vetoable "closed" change first (a veto aborts with no state change), then closes the frame by disposing the peer — which fires INTERNAL_FRAME_CLOSED via the relay.
      Throws:
      PropertyVetoException
    • isIcon

      public boolean isIcon()
    • setIcon

      public void setIcon(boolean b) throws PropertyVetoException
      Iconify / deiconify. Fires "ancestor" first — which reads like a mistake and is not: the JDK's setIcon opens with firePropertyChange("ancestor", null, getParent()), its own comment explaining that a frame iconified before it has a parent needs one created so the icon can be placed on the desktop. Reproduced as written (D_owed_events).
      Throws:
      PropertyVetoException
    • isMaximum

      public boolean isMaximum()
    • setMaximum

      public void setMaximum(boolean b) throws PropertyVetoException
      Constrained property — maximize to viewport-fill (D_internalframe_maximize). Honors the vetoable change, then drives the peer geometry.
      Throws:
      PropertyVetoException
    • isSelected

      public boolean isSelected()
    • setSelected

      public void setSelected(boolean b) throws PropertyVetoException
      Constrained property — selection. Honors the vetoable change, then drives the peer (which fires INTERNAL_FRAME_ACTIVATED / DEACTIVATED via the relay).

      The JDK's showing gate is reproduced, including its asymmetry: selecting a frame that is not showing is refused outright, while deselecting one goes through — so a frame selected on a desktop whose window is then hidden can still be deselected, and fires the whole chain doing it (measured on JDK 25). An iconified frame is gated on its desktop icon showing instead, which is the JDK's own arithmetic and not an approximation of it.

      The JDK's two restoreSubcomponentFocus() calls are not reproduced, and the hook is deliberately absent rather than exposed-and-dead (R_no_vaadin_in_api limb 2 prefers absent): every target its body could focus — the content pane, the frame itself — peers on a Div or a Dialog, neither of which is Vaadin Focusable, so the effect is undeliverable one level down. That also costs the JDK's redundant-select branch, whose whole purpose is that focus restore.

      Throws:
      PropertyVetoException - if a VetoableChangeListener refuses the change
    • dispose

      public void dispose()
      Close and release the frame; fires INTERNAL_FRAME_CLOSED via the relay.
    • doDefaultCloseAction

      public void doDefaultCloseAction()
      DISPOSE honors the vetoable "closed" change (matches JDK); HIDE hides and deselects; DO_NOTHING leaves the frame open.

      INTERNAL_FRAME_CLOSING fires here, before the switch, and for every close operation including DO_NOTHING_ON_CLOSE — which is where the JDK puts it, and why the peer relay no longer fires it. It used to live in the relay, so a migrator calling doDefaultCloseAction() directly from a "Close" menu item got the close without the event (D_owed_events).

    • getDefaultCloseOperation

      public int getDefaultCloseOperation()
    • setDefaultCloseOperation

      public void setDefaultCloseOperation(int operation)
      JDK JInternalFrame.setDefaultCloseOperation stores the value without validation (unlike JFrame/JDialog) — we match that. EXIT is not meaningful here but isn't rejected, mirroring the JDK.
    • getTitle

      public String getTitle()
    • setTitle

      public void setTitle(String title)
    • isResizable

      public boolean isResizable()
    • setResizable

      public void setResizable(boolean b)
    • isClosable

      public boolean isClosable()
    • setClosable

      public void setClosable(boolean b)
    • isMaximizable

      public boolean isMaximizable()
    • setMaximizable

      public void setMaximizable(boolean b)
    • isIconifiable

      public boolean isIconifiable()
    • setIconifiable

      public void setIconifiable(boolean b)
    • getFrameIcon

      public Icon getFrameIcon()
    • setFrameIcon

      public void setFrameIcon(Icon icon)
    • getDesktopIcon

      public JInternalFrame.JDesktopIcon getDesktopIcon()
    • setDesktopIcon

      public void setDesktopIcon(JInternalFrame.JDesktopIcon d)
    • addInternalFrameListener

      public void addInternalFrameListener(InternalFrameListener l)
    • removeInternalFrameListener

      public void removeInternalFrameListener(InternalFrameListener l)
    • getInternalFrameListeners

      public InternalFrameListener[] getInternalFrameListeners()
    • fireInternalFrameEvent

      protected void fireInternalFrameEvent(int id)
      Dispatch one InternalFrameEvent id to registered listeners (source = this).
    • moveToFront

      public void moveToFront()
      Select + best-effort front-raise (overlay order is Vaadin's, R_layouts_close_enough).
    • moveToBack

      public void moveToBack()
    • toFront

      public void toFront()
    • toBack

      public void toBack()
    • getUIClassID

      public String getUIClassID()
      Overrides:
      getUIClassID in class JComponent
    • getAccessibleContext

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