Class JPopupMenu
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, MenuElement
JPopupMenu. R_leaf_peer_lockdown-locked over SJPopupMenu.- See Also:
-
Field Summary
Fields inherited from class JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields 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, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidprotected voidJDK-shaped notifier, kept for the API surface but never reached: the JDK's callers are L&F machinery (dropped per R_match_swing_errors sub-bucket (b)), and the peer'sOpenedChangeEventcannot distinguish a cancel (Esc, click-outside) from an item-selection close — both arrive asopened=falseand firewillBecomeInvisibleonly.protected voidprotected voidintJDK inheritsContainer.getComponentCount(); since our menu children live in this list (not viaContainer.addImpl, per D_menu_tree), override so the count reflects the JDK menu tree.intgetLabel()voidvoidbooleanbooleanvoidmenuSelectionChanged(boolean isIncluded) voidpack()voidprocessKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager) voidprocessMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager) voidremove(int index) voidvoidvoidvoidsetEnabled(boolean enabled) voidsetInvoker(Component invoker) voidvoidsetLightWeightPopupEnabled(boolean enabled) Stores the flag; the popup renders as a Vaadin DOM overlay either way, which is the effect R_decline_effect_only permits dropping.voidsetVisible(boolean visible) Shows or hides the popup, firing the JDK's notifications either way.voidBinds the popup toinvokerso a right-click (or long-press) on it opens the menu, then ends insetVisible(true)as the JDK's own body does.voidupdateUI()Methods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, updateMethods inherited from class Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, addSlotChild, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, fireHierarchyEvent, getComponent, getComponentAt, getComponentAt, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, peerContentElement, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, removeSlotChild, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, applyBackgroundToPeer, applyVisibleToPeer, awtListeners, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, defaultFillCssClass, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, fireComponentEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isThemeDefault, isValid, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, peerIs, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, suppressMouseBridge, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, withPeer, withPeerOnLiveUI
-
Constructor Details
-
JPopupMenu
public JPopupMenu() -
JPopupMenu
-
-
Method Details
-
add
-
add
-
add
-
addSeparator
public void addSeparator() -
insert
-
insert
-
remove
-
remove
-
removeAll
-
getComponentCount
public int getComponentCount()JDK inheritsContainer.getComponentCount(); since our menu children live in this list (not viaContainer.addImpl, per D_menu_tree), override so the count reflects the JDK menu tree.- Overrides:
getComponentCountin classContainer
-
getComponentIndex
-
setEnabled
public void setEnabled(boolean enabled) - Overrides:
setEnabledin classJComponent
-
show
Binds the popup toinvokerso a right-click (or long-press) on it opens the menu, then ends insetVisible(true)as the JDK's own body does. The coordinates are dropped — R_layouts_close_enough position loss, and Vaadin has no programmatic open at a point (SD_sjpopupmenu); the common right-click-triggered idiom works natively once the target is bound.Calling
setVisible(true)here cannot double-fire against the browser's own open in the same round trip: whichever of the two lands first writes the state, and the other hits a no-change early return, so exactly onewillBecomeVisiblereaches the migrator either way. -
setVisible
public void setVisible(boolean visible) Shows or hides the popup, firing the JDK's notifications either way.The two directions are not symmetric, because Vaadin's
ContextMenuis not: it has aclose()but no server-side programmatic open, so hiding really hides while showing is a declined effect (R_match_swing_errors sub-bucket (a) — graduates if upstream lands one). R_decline_effect_only keeps the state and the notification either way, so a migrator'sPopupMenuListenerand"visible"listener fire where they fire on the desktop.The only gate is
b == isVisible()— no displayability check and no invoker needed, a barenew JPopupMenu().setVisible(true)reportingtrueon JDK 25 (measured).Two things the JDK's hide path also does are absent:
firePopupMenuCanceled(), reachable only through the client property its L&F sets, and the selection-model clear,MenuSelectionManagerbeing a WARN-stub with no selection to clear.- Overrides:
setVisiblein classJComponent
-
isVisible
public boolean isVisible()- Overrides:
isVisiblein classComponent- Returns:
- whether the popup is open — the JDK's
popup != null, written bysetVisible(boolean)and by the browser's own open/close alike. Not read off the peer, which would have the getter deny the state a declined programmatic open still owes (R_decline_effect_only).
-
getLabel
-
setLabel
-
pack
public void pack() -
setInvoker
-
isLightWeightPopupEnabled
public boolean isLightWeightPopupEnabled() -
setLightWeightPopupEnabled
public void setLightWeightPopupEnabled(boolean enabled) Stores the flag; the popup renders as a Vaadin DOM overlay either way, which is the effect R_decline_effect_only permits dropping. The state is not — a migrated app that reads the flag back must see what it set. -
getSubElements
- Specified by:
getSubElementsin interfaceMenuElement
-
getComponent
- Specified by:
getComponentin interfaceMenuElement- Returns:
this— the JDK's own answer. SeeJMenuItem.getComponent()for why the portedMenuElementis what makes that possible.
-
processKeyEvent
- Specified by:
processKeyEventin interfaceMenuElement
-
processMouseEvent
- Specified by:
processMouseEventin interfaceMenuElement
-
addPopupMenuListener
-
removePopupMenuListener
-
getPopupMenuListeners
-
firePopupMenuWillBecomeVisible
protected void firePopupMenuWillBecomeVisible() -
firePopupMenuWillBecomeInvisible
protected void firePopupMenuWillBecomeInvisible() -
firePopupMenuCanceled
protected void firePopupMenuCanceled()JDK-shaped notifier, kept for the API surface but never reached: the JDK's callers are L&F machinery (dropped per R_match_swing_errors sub-bucket (b)), and the peer'sOpenedChangeEventcannot distinguish a cancel (Esc, click-outside) from an item-selection close — both arrive asopened=falseand firewillBecomeInvisibleonly. A migrator's override compiles and does not run; documented rather than guessed at, since a heuristic would invent cancels the desktop never fired (R_no_silent_improvements). -
getUIClassID
- Overrides:
getUIClassIDin classJComponent
-
updateUI
public void updateUI()- Overrides:
updateUIin classJComponent
-
getAccessibleContext
- Specified by:
getAccessibleContextin interfaceAccessible- Overrides:
getAccessibleContextin classComponent
-