This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing
class MenuSelectionManager

java.lang.Object extended by javax.swing.MenuSelectionManager

Most common way to construct:

MenuSelectionManager manager = MenuSelectionManager.defaultManager();

Based on 13 examples


public class MenuSelectionManager
extends Object

A MenuSelectionManager owns the selection in menu hierarchy.


Field Summary
protected transient ChangeEvent changeEvent
          Only one ChangeEvent is needed per button model instance since the event's only state is the source property.
protected EventListenerList listenerList
          
 
Constructor Summary

          
 
Method Summary
 void

          Adds a ChangeListener to the button.
 void

          Tell the menu selection to close and unselect all the menu components.
 Component
componentForPoint(Component source, Point sourcePoint)

          Returns the component in the currently selected path which contains sourcePoint.
static MenuSelectionManager

          Returns the default menu selection manager.
protected void

          Notifies all listeners that have registered interest for notification on this event type.
 ChangeListener[]

          Returns an array of all the ChangeListeners added to this MenuSelectionManager with addChangeListener().
 MenuElement[]

          Returns the path to the currently selected menu item
 boolean

          Return true if c is part of the currently used menu
 void

          When a MenuElement receives an event from a KeyListener, it should never process the event directly.
 void

          When a MenuElement receives an event from a MouseListener, it should never process the event directly.
 void

          Removes a ChangeListener from the button.
 void

          Changes the selection in the menu hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

changeEvent

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".

listenerList

protected EventListenerList listenerList
Constructor Detail

MenuSelectionManager

public MenuSelectionManager()
Method Detail

addChangeListener

public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the button.

Parameters:
l - the listener to add

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


componentForPoint

public Component componentForPoint(Component source,
                                   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.

defaultManager

public static MenuSelectionManager defaultManager()
Returns the default menu selection manager.

Returns:
a MenuSelectionManager object

fireStateChanged

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


getChangeListeners

public 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

getSelectedPath

public MenuElement[] getSelectedPath()
Returns the path to the currently selected menu item

Returns:
an array of MenuElement objects representing the selected path

isComponentPartOfCurrentMenu

public boolean isComponentPartOfCurrentMenu(Component c)
Return true if c is part of the currently used menu

Parameters:
c

processKeyEvent

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.

Parameters:
e - a KeyEvent object

processMouseEvent

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.

Parameters:
event - a MouseEvent object

removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the button.

Parameters:
l - the listener to remove

setSelectedPath

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.

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


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.