APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.plaf.basic

public Class BasicPopupMenuUI

extends PopupMenuUI
Class Inheritance
Known Direct Subclasses
javax.swing.plaf.synth.SynthPopupMenuUI, com.sun.java.swing.plaf.motif.MotifPopupMenuUI
Imports
javax.swing.*, javax.swing.event.*, javax.swing.plaf.*, java.awt.Component, .ComponentOrientation, .KeyboardFocusManager, .Window, .AWTEvent, .Toolkit, java.awt.event.*, java.util.*, sun.swing.UIAction

A Windows L&F implementation of PopupMenuUI. This implementation is a "combined" view/controller.
Authors
Georges Saab, David Karlton, Arnaud Weber

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private class
BasicPopupMenuUI.BasicMenuKeyListener

Handles mnemonic for children JMenuItems.

private static class
BasicPopupMenuUI.BasicPopupMenuListener

This Listener fires the Action that provides the correct auditory feedback.

pack-priv static class

Field Summary

Modifier and TypeField and Description
private static boolean
pack-priv static BasicPopupMenuUI.MouseGrabber
protected JPopupMenu
popupMenu

The instance of JPopupMenu.

private transient PopupMenuListener
private static boolean

Constructor Summary

AccessConstructor and Description
public
BasicPopupMenuUI()

Constructs a new instance of BasicPopupMenuUI.

Method Summary

Modifier and TypeMethod and Description
private static boolean
public static ComponentUI

Returns:

a new instance of BasicPopupMenuUI
createUI
(JComponent
a component
x
)

Hides javax.swing.plaf.ComponentUI.createUI.

Constructs a new instance of BasicPopupMenuUI.

pack-priv static MenuElement
findEnabledChild(MenuElement[] e, int fromIndex, boolean forward)

pack-priv static MenuElement
findEnabledChild(MenuElement[] e, MenuElement elem, boolean forward)

pack-priv static ActionMap
pack-priv static MenuElement
pack-priv static InputMap
pack-priv static JPopupMenu
pack-priv static List<JPopupMenu>
public void
installDefaults()

Installs default properties.

protected void
installKeyboardActions()

Registers keyboard actions.

protected void
installListeners()

Registers listeners.

public void
installUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.installUI.

Configures the specified component appropriately for the look and feel.

public boolean
isPopupTrigger(MouseEvent e)

Overrides javax.swing.plaf.PopupMenuUI.isPopupTrigger.

Returns whether or not the given MouseEvent is the popup menu trigger event for the platform

pack-priv static void
private static MenuElement
nextEnabledChild(MenuElement[] e, int fromIndex, int toIndex)

private static MenuElement
previousEnabledChild(MenuElement[] e, int fromIndex, int toIndex)

protected void
uninstallDefaults()

Uninstalls default properties.

protected void
uninstallKeyboardActions()

Unregisters keyboard actions.

protected void
uninstallListeners()

Unregisters listeners.

public void
uninstallUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.uninstallUI.

Reverses configuration which was done on the specified component during installUI.

Inherited from javax.swing.plaf.PopupMenuUI:
getPopup

Field Detail

checkedUnpostPopupback to summary
private static boolean checkedUnpostPopup
mouseGrabberback to summary
pack-priv static BasicPopupMenuUI.MouseGrabber mouseGrabber
popupMenuback to summary
protected JPopupMenu popupMenu

The instance of JPopupMenu.

popupMenuListenerback to summary
private transient PopupMenuListener popupMenuListener
unpostPopupback to summary
private static boolean unpostPopup

Constructor Detail

BasicPopupMenuUIback to summary
public BasicPopupMenuUI()

Constructs a new instance of BasicPopupMenuUI.

Method Detail

checkInvokerEqualback to summary
private static boolean checkInvokerEqual(MenuElement present, MenuElement last)
createUIback to summary
public static ComponentUI createUI(JComponent x)

Hides javax.swing.plaf.ComponentUI.createUI.

Constructs a new instance of BasicPopupMenuUI.

Parameters
x:JComponent

a component

Returns:ComponentUI

a new instance of BasicPopupMenuUI

findEnabledChildback to summary
pack-priv static MenuElement findEnabledChild(MenuElement[] e, int fromIndex, boolean forward)
findEnabledChildback to summary
pack-priv static MenuElement findEnabledChild(MenuElement[] e, MenuElement elem, boolean forward)
getActionMapback to summary
pack-priv static ActionMap getActionMap()
getFirstPopupback to summary
pack-priv static MenuElement getFirstPopup()
getInputMapback to summary
pack-priv static InputMap getInputMap(JPopupMenu popup, JComponent c)
getLastPopupback to summary
pack-priv static JPopupMenu getLastPopup()
getPopupsback to summary
pack-priv static List<JPopupMenu> getPopups()
installDefaultsback to summary
public void installDefaults()

Installs default properties.

installKeyboardActionsback to summary
protected void installKeyboardActions()

Registers keyboard actions.

installListenersback to summary
protected void installListeners()

Registers listeners.

installUIback to summary
public void installUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.installUI.

Doc from javax.swing.plaf.ComponentUI.installUI.

Configures the specified component appropriately for the look and feel. This method is invoked when the ComponentUI instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:

  1. Install default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
  2. Install a LayoutManager on the component if necessary.
  3. Create/add any required sub-components to the component.
  4. Create/install event listeners on the component.
  5. Create/install a PropertyChangeListener on the component in order to detect and respond to component property changes appropriately.
  6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
  7. Initialize any appropriate instance data.
isPopupTriggerback to summary
public boolean isPopupTrigger(MouseEvent e)

Overrides javax.swing.plaf.PopupMenuUI.isPopupTrigger.

Doc from javax.swing.plaf.PopupMenuUI.isPopupTrigger.

Returns whether or not the given MouseEvent is the popup menu trigger event for the platform

Annotations
@SuppressWarnings:deprecation
loadActionMapback to summary
pack-priv static void loadActionMap(LazyActionMap map)
nextEnabledChildback to summary
private static MenuElement nextEnabledChild(MenuElement[] e, int fromIndex, int toIndex)
previousEnabledChildback to summary
private static MenuElement previousEnabledChild(MenuElement[] e, int fromIndex, int toIndex)
uninstallDefaultsback to summary
protected void uninstallDefaults()

Uninstalls default properties.

uninstallKeyboardActionsback to summary
protected void uninstallKeyboardActions()

Unregisters keyboard actions.

uninstallListenersback to summary
protected void uninstallListeners()

Unregisters listeners.

uninstallUIback to summary
public void uninstallUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.uninstallUI.

Doc from javax.swing.plaf.ComponentUI.uninstallUI.

Reverses configuration which was done on the specified component during installUI. This method is invoked when this UIComponent instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in installUI, being careful to leave the JComponent instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:

  1. Remove any UI-set borders from the component.
  2. Remove any UI-set layout managers on the component.
  3. Remove any UI-added sub-components from the component.
  4. Remove any UI-added event/property listeners from the component.
  5. Remove any UI-installed keyboard UI from the component.
  6. Nullify any allocated instance data objects to allow for GC.
javax.swing.plaf.basic back to summary

private Class BasicPopupMenuUI.Actions

extends UIAction
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final boolean
private static final String
private static final boolean
private static final boolean
private static final boolean
private static final String
private static final String
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.

private void
private void
private void
selectItem(boolean direction)

private void
selectParentChild(boolean direction)

private void
Inherited from sun.swing.UIAction:
acceptaddPropertyChangeListenergetNamegetValueisEnabledputValueremovePropertyChangeListenersetEnabled

Field Detail

BACKWARDback to summary
private static final boolean BACKWARD
CANCELback to summary
private static final String CANCEL
CHILDback to summary
private static final boolean CHILD
FORWARDback to summary
private static final boolean FORWARD
PARENTback to summary
private static final boolean PARENT
RETURNback to summary
private static final String RETURN
SELECT_CHILDback to summary
private static final String SELECT_CHILD
SELECT_NEXTback to summary
private static final String SELECT_NEXT
SELECT_PARENTback to summary
private static final String SELECT_PARENT
SELECT_PREVIOUSback to summary
private static final String SELECT_PREVIOUS

Constructor Detail

Actionsback to summary
pack-priv Actions(String key)

Method Detail

actionPerformedback to summary
public void actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Doc from java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.

cancelback to summary
private void cancel()
doReturnback to summary
private void doReturn()
selectItemback to summary
private void selectItem(boolean direction)
selectParentChildback to summary
private void selectParentChild(boolean direction)
shortenSelectedPathback to summary
private void shortenSelectedPath()
javax.swing.plaf.basic back to summary

private Class BasicPopupMenuUI.BasicMenuKeyListener

extends Object
implements MenuKeyListener
Class Inheritance
All Implemented Interfaces
javax.swing.event.MenuKeyListener, java.util.EventListener

Handles mnemonic for children JMenuItems.
Since
1.5

Field Summary

Modifier and TypeField and Description
pack-priv MenuElement

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private char
lower(char keyChar)

private char
lower(int mnemonic)

public void
menuKeyPressed(MenuKeyEvent e)

Implements javax.swing.event.MenuKeyListener.menuKeyPressed.

Invoked when a key has been pressed.

public void
menuKeyReleased(MenuKeyEvent e)

Implements javax.swing.event.MenuKeyListener.menuKeyReleased.

Invoked when a key has been released.

public void
menuKeyTyped(MenuKeyEvent e)

Implements javax.swing.event.MenuKeyListener.menuKeyTyped.

Invoked when a key has been typed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

menuToOpenback to summary
pack-priv MenuElement menuToOpen

Constructor Detail

BasicMenuKeyListenerback to summary
private BasicMenuKeyListener()

Method Detail

lowerback to summary
private char lower(char keyChar)
lowerback to summary
private char lower(int mnemonic)
menuKeyPressedback to summary
public void menuKeyPressed(MenuKeyEvent e)

Implements javax.swing.event.MenuKeyListener.menuKeyPressed.

Doc from javax.swing.event.MenuKeyListener.menuKeyPressed.

Invoked when a key has been pressed.

menuKeyReleasedback to summary
public void menuKeyReleased(MenuKeyEvent e)

Implements javax.swing.event.MenuKeyListener.menuKeyReleased.

Doc from javax.swing.event.MenuKeyListener.menuKeyReleased.

Invoked when a key has been released.

menuKeyTypedback to summary
public void menuKeyTyped(MenuKeyEvent e)

Implements javax.swing.event.MenuKeyListener.menuKeyTyped.

Doc from javax.swing.event.MenuKeyListener.menuKeyTyped.

Invoked when a key has been typed. This event occurs when a key press is followed by a key release.

javax.swing.plaf.basic back to summary

private Class BasicPopupMenuUI.BasicPopupMenuListener

extends Object
implements PopupMenuListener
Class Inheritance
  • java.lang.Object
  • javax.swing.plaf.basic.BasicPopupMenuUI.BasicPopupMenuListener
All Implemented Interfaces
javax.swing.event.PopupMenuListener, java.util.EventListener

This Listener fires the Action that provides the correct auditory feedback.
Since
1.4

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
popupMenuCanceled(PopupMenuEvent e)

Implements javax.swing.event.PopupMenuListener.popupMenuCanceled.

This method is called when the popup menu is canceled

public void
popupMenuWillBecomeInvisible(PopupMenuEvent e)

Implements javax.swing.event.PopupMenuListener.popupMenuWillBecomeInvisible.

This method is called before the popup menu becomes invisible Note that a JPopupMenu can become invisible any time

public void
popupMenuWillBecomeVisible(PopupMenuEvent e)

Implements javax.swing.event.PopupMenuListener.popupMenuWillBecomeVisible.

This method is called before the popup menu becomes visible

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BasicPopupMenuListenerback to summary
private BasicPopupMenuListener()

Method Detail

popupMenuCanceledback to summary
public void popupMenuCanceled(PopupMenuEvent e)

Implements javax.swing.event.PopupMenuListener.popupMenuCanceled.

Doc from javax.swing.event.PopupMenuListener.popupMenuCanceled.

This method is called when the popup menu is canceled

popupMenuWillBecomeInvisibleback to summary
public void popupMenuWillBecomeInvisible(PopupMenuEvent e)

Implements javax.swing.event.PopupMenuListener.popupMenuWillBecomeInvisible.

Doc from javax.swing.event.PopupMenuListener.popupMenuWillBecomeInvisible.

This method is called before the popup menu becomes invisible Note that a JPopupMenu can become invisible any time

popupMenuWillBecomeVisibleback to summary
public void popupMenuWillBecomeVisible(PopupMenuEvent e)

Implements javax.swing.event.PopupMenuListener.popupMenuWillBecomeVisible.

Doc from javax.swing.event.PopupMenuListener.popupMenuWillBecomeVisible.

This method is called before the popup menu becomes visible

javax.swing.plaf.basic back to summary

pack-priv Class BasicPopupMenuUI.MouseGrabber

extends Object
implements ChangeListener, AWTEventListener, ComponentListener, WindowListener
Class Inheritance
All Implemented Interfaces
java.awt.event.WindowListener, java.util.EventListener, java.awt.event.ComponentListener, java.awt.event.AWTEventListener, javax.swing.event.ChangeListener

Field Summary

Modifier and TypeField and Description
pack-priv Window
pack-priv MenuElement[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public void
componentHidden(ComponentEvent e)

Implements java.awt.event.ComponentListener.componentHidden.

Invoked when the component has been made invisible.

public void
componentMoved(ComponentEvent e)

Implements java.awt.event.ComponentListener.componentMoved.

Invoked when the component's position changes.

public void
componentResized(ComponentEvent e)

Implements java.awt.event.ComponentListener.componentResized.

Invoked when the component's size changes.

public void
componentShown(ComponentEvent e)

Implements java.awt.event.ComponentListener.componentShown.

Invoked when the component has been made visible.

public void
eventDispatched(AWTEvent ev)

Implements java.awt.event.AWTEventListener.eventDispatched.

Invoked when an event is dispatched in the AWT.

pack-priv void
pack-priv boolean
pack-priv void
public void
stateChanged(ChangeEvent e)

Implements javax.swing.event.ChangeListener.stateChanged.

Invoked when the target of the listener has changed its state.

pack-priv void
pack-priv void
public void
windowActivated(WindowEvent e)

Implements java.awt.event.WindowListener.windowActivated.

Invoked when the Window is set to be the active Window.

public void
windowClosed(WindowEvent e)

Implements java.awt.event.WindowListener.windowClosed.

Invoked when a window has been closed as the result of calling dispose on the window.

public void
windowClosing(WindowEvent e)

Implements java.awt.event.WindowListener.windowClosing.

Invoked when the user attempts to close the window from the window's system menu.

public void
windowDeactivated(WindowEvent e)

Implements java.awt.event.WindowListener.windowDeactivated.

Invoked when a Window is no longer the active Window.

public void
windowDeiconified(WindowEvent e)

Implements java.awt.event.WindowListener.windowDeiconified.

Invoked when a window is changed from a minimized to a normal state.

public void
windowIconified(WindowEvent e)

Implements java.awt.event.WindowListener.windowIconified.

Invoked when a window is changed from a normal to a minimized state.

public void
windowOpened(WindowEvent e)

Implements java.awt.event.WindowListener.windowOpened.

Invoked the first time a window is made visible.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

grabbedWindowback to summary
pack-priv Window grabbedWindow
lastPathSelectedback to summary
pack-priv MenuElement[] lastPathSelected

Constructor Detail

MouseGrabberback to summary
public MouseGrabber()

Method Detail

cancelPopupMenuback to summary
pack-priv void cancelPopupMenu()
componentHiddenback to summary
public void componentHidden(ComponentEvent e)

Implements java.awt.event.ComponentListener.componentHidden.

Doc from java.awt.event.ComponentListener.componentHidden.

Invoked when the component has been made invisible.

componentMovedback to summary
public void componentMoved(ComponentEvent e)

Implements java.awt.event.ComponentListener.componentMoved.

Doc from java.awt.event.ComponentListener.componentMoved.

Invoked when the component's position changes.

componentResizedback to summary
public void componentResized(ComponentEvent e)

Implements java.awt.event.ComponentListener.componentResized.

Doc from java.awt.event.ComponentListener.componentResized.

Invoked when the component's size changes.

componentShownback to summary
public void componentShown(ComponentEvent e)

Implements java.awt.event.ComponentListener.componentShown.

Doc from java.awt.event.ComponentListener.componentShown.

Invoked when the component has been made visible.

eventDispatchedback to summary
public void eventDispatched(AWTEvent ev)

Implements java.awt.event.AWTEventListener.eventDispatched.

Doc from java.awt.event.AWTEventListener.eventDispatched.

Invoked when an event is dispatched in the AWT.

grabWindowback to summary
pack-priv void grabWindow(MenuElement[] newPath)
isInPopupback to summary
pack-priv boolean isInPopup(Component src)
realUngrabWindowback to summary
pack-priv void realUngrabWindow()
stateChangedback to summary
public void stateChanged(ChangeEvent e)

Implements javax.swing.event.ChangeListener.stateChanged.

Doc from javax.swing.event.ChangeListener.stateChanged.

Invoked when the target of the listener has changed its state.

ungrabWindowback to summary
pack-priv void ungrabWindow()
uninstallback to summary
pack-priv void uninstall()
windowActivatedback to summary
public void windowActivated(WindowEvent e)

Implements java.awt.event.WindowListener.windowActivated.

Doc from java.awt.event.WindowListener.windowActivated.

Invoked when the Window is set to be the active Window. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.

windowClosedback to summary
public void windowClosed(WindowEvent e)

Implements java.awt.event.WindowListener.windowClosed.

Doc from java.awt.event.WindowListener.windowClosed.

Invoked when a window has been closed as the result of calling dispose on the window.

windowClosingback to summary
public void windowClosing(WindowEvent e)

Implements java.awt.event.WindowListener.windowClosing.

Doc from java.awt.event.WindowListener.windowClosing.

Invoked when the user attempts to close the window from the window's system menu.

windowDeactivatedback to summary
public void windowDeactivated(WindowEvent e)

Implements java.awt.event.WindowListener.windowDeactivated.

Doc from java.awt.event.WindowListener.windowDeactivated.

Invoked when a Window is no longer the active Window. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.

windowDeiconifiedback to summary
public void windowDeiconified(WindowEvent e)

Implements java.awt.event.WindowListener.windowDeiconified.

Doc from java.awt.event.WindowListener.windowDeiconified.

Invoked when a window is changed from a minimized to a normal state.

windowIconifiedback to summary
public void windowIconified(WindowEvent e)

Implements java.awt.event.WindowListener.windowIconified.

Doc from java.awt.event.WindowListener.windowIconified.

Invoked when a window is changed from a normal to a minimized state. For many platforms, a minimized window is displayed as the icon specified in the window's iconImage property.

windowOpenedback to summary
public void windowOpened(WindowEvent e)

Implements java.awt.event.WindowListener.windowOpened.

Doc from java.awt.event.WindowListener.windowOpened.

Invoked the first time a window is made visible.