javax.swing
Class MenuSelectionManager
java.lang.Object
|
+--javax.swing.MenuSelectionManager
- public class MenuSelectionManager
- extends Object
Safe:
Field Summary
protected ChangeEvent
changeEvent
Only one ChangeEvent is needed per button model instance since the
event's only state is the source property.
private static boolean
DEBUG
private static boolean
TRACE
Constructor Summary
Method Summary
void
clearSelectedPath()
Enabled: Tell the menu selection to close and unselect all the menu components.
protected void
fireStateChanged()
Notifies all listeners that have registered interest for
notification on this event type.
void
processKeyEvent(KeyEvent e)
Suppressed: When a MenuElement receives an event from a KeyListener, it should never process the event
directly.
void
processMouseEvent(MouseEvent event)
Suppressed: When a MenuElement receives an event from a MouseListener, it should never process the event
directly.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail
instance
private static final MenuSelectionManager instance
selection
private Vector selection
TRACE
private static final boolean TRACE
VERBOSE
private static final boolean VERBOSE
DEBUG
private static final boolean DEBUG
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()
- Enabled:
Method Detail
defaultManager
public static MenuSelectionManager defaultManager()
- Suppressed: Returns the default menu selection manager.
- Returns:
- a MenuSelectionManager object
setSelectedPath
public void setSelectedPath(MenuElement[] path)
- Enabled: Change the selection in the menu hierarchy.
- Parameters:
path - an array of MenuElement objects specifying the selected path
getSelectedPath
public MenuElement[] getSelectedPath()
- Enabled: Returns the path to the currently selected menu item
- Returns:
- an array of MenuElement objects representing the selected path
clearSelectedPath
public void clearSelectedPath()
- Enabled: Tell the menu selection to close and unselect all the menu components. Call this method
when a choice has been made
-
addChangeListener
public void addChangeListener(ChangeListener l)
- Enabled: Adds a ChangeListener to the button.
- Parameters:
l - the listener to add
removeChangeListener
public void removeChangeListener(ChangeListener l)
- Enabled: Removes a ChangeListener from the button.
- Parameters:
l - the listener to remove
getChangeListeners
public ChangeListener[] getChangeListeners()
- Suppressed: 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
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
processMouseEvent
public void processMouseEvent(MouseEvent event)
- Suppressed: 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
printMenuElementArray
private void printMenuElementArray(MenuElement[] path)
-
printMenuElementArray
private void printMenuElementArray(MenuElement[] path,
boolean dumpStack)
-
componentForPoint
public Component componentForPoint(Component source,
Point sourcePoint)
- Enabled: Returns the component in the currently selected path
which contains sourcePoint.
- Parameters:
source - The component in whose coordinate space sourcePoint
is givensourcePoint - 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
public void processKeyEvent(KeyEvent e)
- Suppressed: 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
public boolean isComponentPartOfCurrentMenu(Component c)
- Enabled:
Return true if c is part of the currently used menu
-
isComponentPartOfCurrentMenu
private boolean isComponentPartOfCurrentMenu(MenuElement root,
Component c)
-