public class MenuSelectionManager extends Object
Modifier and Type | Field | Description |
---|---|---|
protected ChangeEvent |
changeEvent |
Only one ChangeEvent is needed per button model instance since the event's only state is the source property. |
protected EventListenerList |
listenerList |
The collection of registered listeners |
Constructor | Description |
---|---|
MenuSelectionManager() |
Constructs a MenuSelectionManager . |
Modifier and Type | Method | Description |
---|---|---|
void |
addChangeListener |
Adds a ChangeListener to the button. |
void |
clearSelectedPath() |
Tell the menu selection to close and unselect all the menu components. |
Component |
componentForPoint |
Returns the component in the currently selected path which contains sourcePoint. |
static MenuSelectionManager |
defaultManager() |
Returns the default menu selection manager. |
protected void |
fireStateChanged() |
Notifies all listeners that have registered interest for notification on this event type. |
ChangeListener[] |
getChangeListeners() |
Returns an array of all the ChangeListener s added to this MenuSelectionManager with addChangeListener(). |
MenuElement[] |
getSelectedPath() |
Returns the path to the currently selected menu item |
boolean |
isComponentPartOfCurrentMenu |
Return true if c is part of the currently used menu |
void |
processKeyEvent |
When a MenuElement receives an event from a KeyListener, it should never process the event directly. |
void |
processMouseEvent |
When a MenuElement receives an event from a MouseListener, it should never process the event directly. |
void |
removeChangeListener |
Removes a ChangeListener from the button. |
void |
setSelectedPath |
Changes the selection in the menu hierarchy. |
protected transient ChangeEvent changeEvent
protected EventListenerList listenerList
public MenuSelectionManager()
MenuSelectionManager
.public static MenuSelectionManager defaultManager()
public void setSelectedPath(MenuElement[] path)
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 MenuElement
objects specifying the selected pathpublic MenuElement[] getSelectedPath()
public void clearSelectedPath()
public void addChangeListener(ChangeListener l)
l
- the listener to addpublic void removeChangeListener(ChangeListener l)
l
- the listener to removepublic ChangeListener[] getChangeListeners()
ChangeListener
s added to this MenuSelectionManager with addChangeListener().ChangeListener
s added or an empty array if no listeners have been addedprotected void fireStateChanged()
public void processMouseEvent(MouseEvent event)
event
- a MouseEvent objectpublic Component componentForPoint(Component source, Point sourcePoint)
source
- The component in whose coordinate space sourcePoint is givensourcePoint
- The point which is being testedpublic void processKeyEvent(KeyEvent e)
e
- a KeyEvent objectpublic boolean isComponentPartOfCurrentMenu(Component c)
c
is part of the currently used menuc
- a Component
c
is part of the currently used menu, false otherwise
© 1993, 2023, 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.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/MenuSelectionManager.html