javax.swing
Class MenuSelectionManager

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.MenuSelectionManager

public class MenuSelectionManager
extends Object sample code for java.lang.Object definition code for java.lang.Object

A MenuSelectionManager owns the selection in menu hierarchy.


Field Summary
protected  ChangeEvent sample code for javax.swing.event.ChangeEvent definition code for javax.swing.event.ChangeEvent changeEvent sample code for javax.swing.MenuSelectionManager.changeEvent definition code for javax.swing.MenuSelectionManager.changeEvent
          Only one ChangeEvent is needed per button model instance since the event's only state is the source property.
protected  EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList listenerList sample code for javax.swing.MenuSelectionManager.listenerList definition code for javax.swing.MenuSelectionManager.listenerList
           
 
Constructor Summary
MenuSelectionManager sample code for javax.swing.MenuSelectionManager.MenuSelectionManager() definition code for javax.swing.MenuSelectionManager.MenuSelectionManager() ()
           
 
Method Summary
 void addChangeListener sample code for javax.swing.MenuSelectionManager.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.MenuSelectionManager.addChangeListener(javax.swing.event.ChangeListener) (ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
          Adds a ChangeListener to the button.
 void clearSelectedPath sample code for javax.swing.MenuSelectionManager.clearSelectedPath() definition code for javax.swing.MenuSelectionManager.clearSelectedPath() ()
          Tell the menu selection to close and unselect all the menu components.
 Component sample code for java.awt.Component definition code for java.awt.Component componentForPoint sample code for javax.swing.MenuSelectionManager.componentForPoint(java.awt.Component, java.awt.Point) definition code for javax.swing.MenuSelectionManager.componentForPoint(java.awt.Component, java.awt.Point) (Component sample code for java.awt.Component definition code for java.awt.Component  source, Point sample code for java.awt.Point definition code for java.awt.Point  sourcePoint)
          Returns the component in the currently selected path which contains sourcePoint.
static MenuSelectionManager sample code for javax.swing.MenuSelectionManager definition code for javax.swing.MenuSelectionManager defaultManager sample code for javax.swing.MenuSelectionManager.defaultManager() definition code for javax.swing.MenuSelectionManager.defaultManager() ()
          Returns the default menu selection manager.
protected  void fireStateChanged sample code for javax.swing.MenuSelectionManager.fireStateChanged() definition code for javax.swing.MenuSelectionManager.fireStateChanged() ()
          Notifies all listeners that have registered interest for notification on this event type.
 ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener [] getChangeListeners sample code for javax.swing.MenuSelectionManager.getChangeListeners() definition code for javax.swing.MenuSelectionManager.getChangeListeners() ()
          Returns an array of all the ChangeListeners added to this MenuSelectionManager with addChangeListener().
 MenuElement sample code for javax.swing.MenuElement definition code for javax.swing.MenuElement [] getSelectedPath sample code for javax.swing.MenuSelectionManager.getSelectedPath() definition code for javax.swing.MenuSelectionManager.getSelectedPath() ()
          Returns the path to the currently selected menu item
 boolean isComponentPartOfCurrentMenu sample code for javax.swing.MenuSelectionManager.isComponentPartOfCurrentMenu(java.awt.Component) definition code for javax.swing.MenuSelectionManager.isComponentPartOfCurrentMenu(java.awt.Component) (Component sample code for java.awt.Component definition code for java.awt.Component  c)
          Return true if c is part of the currently used menu
 void processKeyEvent sample code for javax.swing.MenuSelectionManager.processKeyEvent(java.awt.event.KeyEvent) definition code for javax.swing.MenuSelectionManager.processKeyEvent(java.awt.event.KeyEvent) (KeyEvent sample code for java.awt.event.KeyEvent definition code for java.awt.event.KeyEvent  e)
          When a MenuElement receives an event from a KeyListener, it should never process the event directly.
 void processMouseEvent sample code for javax.swing.MenuSelectionManager.processMouseEvent(java.awt.event.MouseEvent) definition code for javax.swing.MenuSelectionManager.processMouseEvent(java.awt.event.MouseEvent) (MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  event)
          When a MenuElement receives an event from a MouseListener, it should never process the event directly.
 void removeChangeListener sample code for javax.swing.MenuSelectionManager.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.MenuSelectionManager.removeChangeListener(javax.swing.event.ChangeListener) (ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
          Removes a ChangeListener from the button.
 void setSelectedPath sample code for javax.swing.MenuSelectionManager.setSelectedPath(javax.swing.MenuElement[]) definition code for javax.swing.MenuSelectionManager.setSelectedPath(javax.swing.MenuElement[]) (MenuElement sample code for javax.swing.MenuElement definition code for javax.swing.MenuElement [] path)
          Changes the selection in the menu hierarchy.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

changeEvent sample code for javax.swing.MenuSelectionManager.changeEvent

protected transient ChangeEvent sample code for javax.swing.event.ChangeEvent definition code for javax.swing.event.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".


listenerList sample code for javax.swing.MenuSelectionManager.listenerList

protected EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList  listenerList
Constructor Detail

MenuSelectionManager sample code for javax.swing.MenuSelectionManager() definition code for javax.swing.MenuSelectionManager()

public MenuSelectionManager()
Method Detail

defaultManager sample code for javax.swing.MenuSelectionManager.defaultManager() definition code for javax.swing.MenuSelectionManager.defaultManager()

public static MenuSelectionManager sample code for javax.swing.MenuSelectionManager definition code for javax.swing.MenuSelectionManager  defaultManager()
Returns the default menu selection manager.

Returns:
a MenuSelectionManager object

setSelectedPath sample code for javax.swing.MenuSelectionManager.setSelectedPath(javax.swing.MenuElement[]) definition code for javax.swing.MenuSelectionManager.setSelectedPath(javax.swing.MenuElement[])

public void setSelectedPath(MenuElement sample code for javax.swing.MenuElement definition code for javax.swing.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.

Parameters:
path - an array of MenuElement objects specifying the selected path

getSelectedPath sample code for javax.swing.MenuSelectionManager.getSelectedPath() definition code for javax.swing.MenuSelectionManager.getSelectedPath()

public MenuElement sample code for javax.swing.MenuElement definition code for javax.swing.MenuElement [] getSelectedPath()
Returns the path to the currently selected menu item

Returns:
an array of MenuElement objects representing the selected path

clearSelectedPath sample code for javax.swing.MenuSelectionManager.clearSelectedPath() definition code for javax.swing.MenuSelectionManager.clearSelectedPath()

public void clearSelectedPath()
Tell the menu selection to close and unselect all the menu components. Call this method when a choice has been made


addChangeListener sample code for javax.swing.MenuSelectionManager.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.MenuSelectionManager.addChangeListener(javax.swing.event.ChangeListener)

public void addChangeListener(ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
Adds a ChangeListener to the button.

Parameters:
l - the listener to add

removeChangeListener sample code for javax.swing.MenuSelectionManager.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.MenuSelectionManager.removeChangeListener(javax.swing.event.ChangeListener)

public void removeChangeListener(ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
Removes a ChangeListener from the button.

Parameters:
l - the listener to remove

getChangeListeners sample code for javax.swing.MenuSelectionManager.getChangeListeners() definition code for javax.swing.MenuSelectionManager.getChangeListeners()

public ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener [] getChangeListeners()
Returns an array of all the ChangeListeners 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

fireStateChanged sample code for javax.swing.MenuSelectionManager.fireStateChanged() definition code for javax.swing.MenuSelectionManager.fireStateChanged()

protected void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList

processMouseEvent sample code for javax.swing.MenuSelectionManager.processMouseEvent(java.awt.event.MouseEvent) definition code for javax.swing.MenuSelectionManager.processMouseEvent(java.awt.event.MouseEvent)

public void processMouseEvent(MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.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.

Parameters:
event - a MouseEvent object

componentForPoint sample code for javax.swing.MenuSelectionManager.componentForPoint(java.awt.Component, java.awt.Point) definition code for javax.swing.MenuSelectionManager.componentForPoint(java.awt.Component, java.awt.Point)

public Component sample code for java.awt.Component definition code for java.awt.Component  componentForPoint(Component sample code for java.awt.Component definition code for java.awt.Component  source,
                                   Point sample code for java.awt.Point definition code for java.awt.Point  sourcePoint)
Returns 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.

processKeyEvent sample code for javax.swing.MenuSelectionManager.processKeyEvent(java.awt.event.KeyEvent) definition code for javax.swing.MenuSelectionManager.processKeyEvent(java.awt.event.KeyEvent)

public void processKeyEvent(KeyEvent sample code for java.awt.event.KeyEvent definition code for java.awt.event.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.

Parameters:
e - a KeyEvent object

isComponentPartOfCurrentMenu sample code for javax.swing.MenuSelectionManager.isComponentPartOfCurrentMenu(java.awt.Component) definition code for javax.swing.MenuSelectionManager.isComponentPartOfCurrentMenu(java.awt.Component)

public boolean isComponentPartOfCurrentMenu(Component sample code for java.awt.Component definition code for java.awt.Component  c)
Return true if c is part of the currently used menu