Class JFrame
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, WindowConstants, RootPaneContainer
JFrame. Per
D_jframe_as_route,
a JFrame's rendering shape is selected at construction via
FrameStrategy: DialogStrategy (regular JFrame, peer is
SJFrame) or InlineStrategy
(@MainWindow-annotated, peer is
SJPanel, attached to a
MainWindowRoute).
R_leaf_peer_lockdown-locked-down: no protected (Component peer) ctor — every
public ctor funnels through a private (FrameStrategy) ctor that
hard-codes the strategy's peer type. The framework selects among
SJFrame/SJPanel based on the @MainWindow
annotation per
D_framework_peer_selection;
user code cannot influence the choice.
- See Also:
-
Field Summary
FieldsFields inherited from class Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSORFields inherited from class Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, FILL_CHROME, FILL_DEFAULT, LEFT_ALIGNMENT, listenerList, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidapplyVisibleToPeerImpl(boolean b) Strategy hook forWindow.show()/Window.hide()— delegates the peer-side write throughFrameStrategy.applyVisibleToPeer(JFrame, boolean)so InlineStrategy can substitute a route-attach for the default Dialog-open path.protected JRootPanestatic voiddispatchShutdownFromTabClose(com.vaadin.flow.server.VaadinSession session) Prompt-dispatch entry for the tab-scope destroy listener (AppTab.onTabClosed(VaadinSession, TabScope)): fires the D_shutdown_lifecycleWINDOW_CLOSINGon a real app-tab close directly, rather than waiting for theVaadinSession-destroy backstop.protected voidStrategy hook forWindow.dispose()— delegates peer tear-down throughFrameStrategy.disposePeer(JFrame)so InlineStrategy can substitute a route-detach for the default SWindow.dispose path.protected voidThe JDK's own body (JFrame.java:255), line for line: enable the window event masks, take the default locale, build the root pane throughcreateRootPane()and plant it viasetRootPane(JRootPane), take the L&F control background, then turn root-pane checking on — each as a call, so a subclass override of any hook actually runs (R_no_vaadin_in_api limb 2).Delegates to the root pane, as the JDK's does (JFrame.java:645).intstatic booleanprotected booleanWhetheradd/remove/setLayoutredirect into the content pane.voidpack()Window.pack()hook for the inline-strategy route-sizing model — default path is a no-op (PWA shape: route stayssetSizeFull, SJPanel stayswidth:100% / height:100%pinned bysetPreferredSize(Dimension)below).protected Stringprotected voidAWT's Window.processWindowEvent routes WINDOW_CLOSING to registered listeners; we extend that here to also apply the default close operation after the user's listeners have run.voidvoidrepaint(long arg0, int arg1, int arg2, int arg3, int arg4) voidsetContentPane(Container newPane) Delegates to the root pane, as the JDK's does (JFrame.java:668) — soframe.getContentPane()andframe.getRootPane().getContentPane()are the same pane by construction rather than by a mirror that has to be kept in step.voidsetDefaultCloseOperation(int operation) static voidsetDefaultLookAndFeelDecorated(boolean arg0) voidsetGlassPane(Component glass) voidsetIconImage(Image arg0) voidsetJMenuBar(JMenuBar bar) Delegates to the root pane, as the JDK's does (JFrame.java:470) — soframe.setJMenuBar(x)andframe.getRootPane().setJMenuBar(x)are the same bar, where they used to be two.voidsetLayeredPane(JLayeredPane layered) voidsetLayout(LayoutManager manager) Stores the manager and invalidates as AWT does, minus the CSS dispatch — seeWindow.windowLayout.voidsetPreferredSize(Dimension preferredSize) OverridesComponent.setPreferredSize(Dimension)for the InlineStrategy PWA-shape default: a @MainWindow JFrame fills the viewport regardless of the user's preferred-size request.protected voidsetRootPane(JRootPane newRootPane) The JDK's body (JFrame.java:613): remove the outgoing root pane, then add the incoming one.protected voidsetRootPaneCheckingEnabled(boolean enabled) voidvoidsetTransferHandler(TransferHandler newHandler) voidMethods inherited from class Frame
getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setUndecoratedMethods inherited from class Window
addNotify, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, applyVisibleToPeer, blocksAfterVisibilityChange, createBufferStrategy, createBufferStrategy, dispose, fireWindowEvent, fireWindowFocusEvent, fireWindowStateEvent, getBackground, getBounds, getBounds, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getHeight, getIconImages, getInputContext, getLayout, getLocale, getLocation, getLocation, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getSize, getSize, getToolkit, getWarningString, getWidth, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, getX, getY, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isValidateRoot, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setSize, setSize, setVisible, show, toBack, toFrontMethods inherited from class Container
add, add, add, add, add, addContainerListener, addSlotChild, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, fireHierarchyEvent, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, peerContentElement, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeSlotChild, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, applyBackgroundToPeer, awtListeners, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, defaultFillCssClass, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, fireComponentEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isThemeDefault, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, show, size, suppressMouseBridge, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, withPeer, withPeerOnLiveUI
-
Field Details
-
rootPane
-
rootPaneCheckingEnabled
protected boolean rootPaneCheckingEnabled
-
-
Constructor Details
-
JFrame
-
JFrame
- Throws:
HeadlessException
-
JFrame
-
JFrame
- Throws:
HeadlessException
-
-
Method Details
-
frameInit
protected void frameInit()The JDK's own body (JFrame.java:255), line for line: enable the window event masks, take the default locale, build the root pane throughcreateRootPane()and plant it viasetRootPane(JRootPane), take the L&F control background, then turn root-pane checking on — each as a call, so a subclass override of any hook actually runs (R_no_vaadin_in_api limb 2). The frame's single child is the root pane; everything else hangs off it.Two of those lines land on deliberate nothings, and the nothings are where the fidelity is:
enableEventsno-ops because dispatch is already unconditional, andUIManager.controlColor()is null because L&F is out of scope. Both still *run*, so a migrator'ssetBackgroundoverride fires from the constructor exactly as on the desktop. -
pack
public void pack()Window.pack()hook for the inline-strategy route-sizing model — default path is a no-op (PWA shape: route stayssetSizeFull, SJPanel stayswidth:100% / height:100%pinned bysetPreferredSize(Dimension)below). ThesetResizable(false) + setPreferredSize + pack()opt-out path runs the route-shrink + pixel-write inInlineStrategy.applyInlineSizingOnPack(JFrame). Per D_inline_route_sizing. DialogStrategy retains the inherited onNoop behaviour (Dialog peer auto-sizes regardless). -
setPreferredSize
OverridesComponent.setPreferredSize(Dimension)for the InlineStrategy PWA-shape default: a @MainWindow JFrame fills the viewport regardless of the user's preferred-size request. Super still field-shadows the value and fires PCE, sogetPreferredSize()round-trips per R_swing_is_truth; we re-pinwidth:100% / height:100%over the parent's pixel write. ThesetResizable(false)carve-out lets the parent's pixel write stand for fixed-size main windows. DialogStrategy bypasses this branch — Dialog peer sizing is driven by Component.setPreferredSize verbatim. Per D_inline_route_sizing.- Overrides:
setPreferredSizein classComponent
-
getContentPane
Delegates to the root pane, as the JDK's does (JFrame.java:645).- Specified by:
getContentPanein interfaceRootPaneContainer
-
setContentPane
Delegates to the root pane, as the JDK's does (JFrame.java:668) — soframe.getContentPane()andframe.getRootPane().getContentPane()are the same pane by construction rather than by a mirror that has to be kept in step.- Specified by:
setContentPanein interfaceRootPaneContainer
-
addImpl
-
setLayout
Description copied from class:WindowStores the manager and invalidates as AWT does, minus the CSS dispatch — seeWindow.windowLayout. -
remove
-
setRootPaneCheckingEnabled
protected void setRootPaneCheckingEnabled(boolean enabled) -
isRootPaneCheckingEnabled
protected boolean isRootPaneCheckingEnabled()Whetheradd/remove/setLayoutredirect 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
- Specified by:
getRootPanein interfaceRootPaneContainer
-
setRootPane
The JDK's body (JFrame.java:613): remove the outgoing root pane, then add the incoming one. Runs with root-pane checking cleared soaddImpl(Component, Object, int)'s redirect falls through toContainer's rather than routing the new root pane into the old one's content pane. -
createRootPane
-
getLayeredPane
- Specified by:
getLayeredPanein interfaceRootPaneContainer
-
setLayeredPane
- Specified by:
setLayeredPanein interfaceRootPaneContainer
-
getGlassPane
- Specified by:
getGlassPanein interfaceRootPaneContainer
-
setGlassPane
- Specified by:
setGlassPanein interfaceRootPaneContainer
-
update
-
paramString
- Overrides:
paramStringin classFrame
-
processWindowEvent
AWT's Window.processWindowEvent routes WINDOW_CLOSING to registered listeners; we extend that here to also apply the default close operation after the user's listeners have run. Running super first matches Swing's ordering — if a WindowListener calls System.exit or otherwise short-circuits the app, the default op doesn't get a chance to interfere.Per D_close_operation_dispatch, close-op dispatch differs by strategy:
DialogStrategy:EXIT_ON_CLOSEthrowsIllegalStateExceptionper D_gap_severity_triage case 2.InlineStrategydisposes onEXIT_ON_CLOSE; the session then ends throughAutoShutdownif that took the app's last displayable window (D_auto_shutdown).DISPOSE_ON_CLOSEcallsWindow.dispose();HIDE/DO_NOTHINGare no-ops in both strategies (HIDE is already effectively done by the time we get here, and DO_NOTHING doesn't reach us in practice — setter disarms the peer's close gestures).
- Overrides:
processWindowEventin classWindow
-
applyVisibleToPeerImpl
protected void applyVisibleToPeerImpl(boolean b) Strategy hook forWindow.show()/Window.hide()— delegates the peer-side write throughFrameStrategy.applyVisibleToPeer(JFrame, boolean)so InlineStrategy can substitute a route-attach for the default Dialog-open path. Higher-level event firing (COMPONENT_SHOWN/HIDDEN, WINDOW_OPENED) stays in Window, same for both strategies.- Overrides:
applyVisibleToPeerImplin classWindow
-
disposePeer
protected void disposePeer()Strategy hook forWindow.dispose()— delegates peer tear-down throughFrameStrategy.disposePeer(JFrame)so InlineStrategy can substitute a route-detach for the default SWindow.dispose path.- Overrides:
disposePeerin classWindow
-
setTitle
-
isDefaultLookAndFeelDecorated
public static boolean isDefaultLookAndFeelDecorated() -
setJMenuBar
Delegates to the root pane, as the JDK's does (JFrame.java:470) — soframe.setJMenuBar(x)andframe.getRootPane().setJMenuBar(x)are the same bar, where they used to be two. The bar is planted in the root pane's layered pane, above the content pane.No
"JMenuBar"bound property: the JDK routessetJMenuBarintoJRootPane, and neither class fires anything for it. Firing one here handed migrated code a PropertyChangeEvent that never existed (R_decline_effect_only, D_window_fanout).JDK-shape signature uses
javax.swing.JMenuBar; we acceptJMenuBarper the import-swap migration arc (Stage 2 — user code rewritesimport javax.swing.JMenuBar→import vaadinx.swing.JMenuBar). -
getJMenuBar
-
setIconImage
- Overrides:
setIconImagein classWindow
-
getGraphics
- Overrides:
getGraphicsin classComponent
-
repaint
-
setDefaultCloseOperation
public void setDefaultCloseOperation(int operation) -
getDefaultCloseOperation
public int getDefaultCloseOperation() -
setTransferHandler
-
getTransferHandler
-
setDefaultLookAndFeelDecorated
public static void setDefaultLookAndFeelDecorated(boolean arg0) -
getAccessibleContext
- Specified by:
getAccessibleContextin interfaceAccessible- Overrides:
getAccessibleContextin classFrame
-
dispatchShutdownFromTabClose
public static void dispatchShutdownFromTabClose(com.vaadin.flow.server.VaadinSession session) Prompt-dispatch entry for the tab-scope destroy listener (AppTab.onTabClosed(VaadinSession, TabScope)): fires the D_shutdown_lifecycleWINDOW_CLOSINGon a real app-tab close directly, rather than waiting for theVaadinSession-destroy backstop. Public only to cross thevaadinx→vaadinx.swingpackage seam; see the "Shutdown lifecycle (D_shutdown_lifecycle)" note above for why the reaper thread can't rely on the backstop.
-