java.lang.Object
javax.swing.MenuSelectionManager
A MenuSelectionManager owns the selection in menu hierarchy.
- Since:
- 1.2
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected ChangeEventOnly one ChangeEvent is needed per button model instance since the event's only state is the source property.protected EventListenerListThe collection of registered listeners
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds a ChangeListener to the button.voidTell the menu selection to close and unselect all the menu components.componentForPoint(Component source, Point sourcePoint) Returns the component in the currently selected path which contains sourcePoint.static MenuSelectionManagerReturns the default menu selection manager.protected voidNotifies all listeners that have registered interest for notification on this event type.Returns an array of all theChangeListeners added to this MenuSelectionManager with addChangeListener().Returns the path to the currently selected menu itembooleanReturn true ifcis part of the currently used menuvoidWhen a MenuElement receives an event from a KeyListener, it should never process the event directly.voidprocessMouseEvent(MouseEvent event) When a MenuElement receives an event from a MouseListener, it should never process the event directly.voidRemoves a ChangeListener from the button.voidsetSelectedPath(MenuElement[] path) Changes the selection in the menu hierarchy.
- 
Field Details- 
changeEventOnly 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".
- 
listenerListThe collection of registered listeners
 
- 
- 
Constructor Details- 
MenuSelectionManagerpublic MenuSelectionManager()Constructs aMenuSelectionManager.
 
- 
- 
Method Details- 
defaultManagerReturns the default menu selection manager.- Returns:
- a MenuSelectionManager object
 
- 
setSelectedPathChanges 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. - Parameters:
- path- an array of- MenuElementobjects specifying the selected path
 
- 
getSelectedPathReturns the path to the currently selected menu item- Returns:
- an array of MenuElement objects representing the selected path
 
- 
clearSelectedPathpublic void clearSelectedPath()Tell the menu selection to close and unselect all the menu components. Call this method when a choice has been made
- 
addChangeListenerAdds a ChangeListener to the button.- Parameters:
- l- the listener to add
 
- 
removeChangeListenerRemoves a ChangeListener from the button.- Parameters:
- l- the listener to remove
 
- 
getChangeListenersReturns an array of all theChangeListeners added to this MenuSelectionManager with addChangeListener().- Returns:
- all of the ChangeListeners added or an empty array if no listeners have been added
- Since:
- 1.4
 
- 
fireStateChangedprotected void fireStateChanged()Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.- See Also:
 
- 
processMouseEventWhen 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.- Parameters:
- event- a MouseEvent object
 
- 
componentForPointReturns the component in the currently selected path which contains sourcePoint.- Parameters:
- source- The component in whose coordinate space sourcePoint is given
- sourcePoint- The point which is being tested
- Returns:
- The component in the currently selected path which contains sourcePoint (relative to the source component's coordinate space. If sourcePoint is not inside a component on the currently selected path, null is returned.
 
- 
processKeyEventWhen 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.- Parameters:
- e- a KeyEvent object
 
- 
isComponentPartOfCurrentMenuReturn true ifcis part of the currently used menu- Parameters:
- c- a- Component
- Returns:
- true if cis part of the currently used menu, false otherwise
 
 
-