public class MenuSelectionManager extends Object
A MenuSelectionManager owns the selection in menu hierarchy.
protected transient ChangeEvent changeEvent
Only one ChangeEvent is needed per button model instance since the event's only state is the source property. The source of events generated is always "this".
protected EventListenerList listenerList
public static MenuSelectionManager defaultManager()
Returns the default menu selection manager.
public void setSelectedPath(MenuElement path)
Changes the selection in the menu hierarchy. The elements in the array are sorted in order from the root menu element to the currently selected menu element.
Note that this method is public but is used by the look and feel engine and should not be called by client applications.
path- an array of
MenuElementobjects specifying the selected path
public MenuElement getSelectedPath()
Returns the path to the currently selected menu item
public void clearSelectedPath()
Tell the menu selection to close and unselect all the menu components. Call this method when a choice has been made
public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the button.
l- the listener to add
public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the button.
l- the listener to remove
public ChangeListener getChangeListeners()
Returns an array of all the
ChangeListeners added to this MenuSelectionManager with addChangeListener().
ChangeListeners added or an empty array if no listeners have been added
protected void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.
public void processMouseEvent(MouseEvent event)
When a MenuElement receives an event from a MouseListener, it should never process the event directly. Instead all MenuElements should call this method with the event.
event- a MouseEvent object
public Component componentForPoint(Component source, Point sourcePoint)
Returns the component in the currently selected path which contains sourcePoint.
source- The component in whose coordinate space sourcePoint is given
sourcePoint- The point which is being tested
public void processKeyEvent(KeyEvent e)
When a MenuElement receives an event from a KeyListener, it should never process the event directly. Instead all MenuElements should call this method with the event.
e- a KeyEvent object
public boolean isComponentPartOfCurrentMenu(Component c)
Return true if c is part of the currently used menu
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.