javax.swing

Class MenuSelectionManager


  • public class MenuSelectionManager
    extends Object
    A MenuSelectionManager owns the selection in menu hierarchy.
    • 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".
    • Constructor Detail

      • public MenuSelectionManager()
    • Method Detail

      • defaultManager

        public static MenuSelectionManager defaultManager()
        Returns the default menu selection manager.
        Returns:
        a MenuSelectionManager object
      • 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
      • getSelectedPath

        public MenuElement[] getSelectedPath()
        Returns the path to the currently selected menu item
        Returns:
        an array of MenuElement objects representing the selected path
      • 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

        public void addChangeListener(ChangeListener l)
        Adds a ChangeListener to the button.
        Parameters:
        l - the listener to add
      • removeChangeListener

        public void removeChangeListener(ChangeListener l)
        Removes a ChangeListener from the button.
        Parameters:
        l - the listener to remove
      • 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
        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)
        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

        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.
      • 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
      • isComponentPartOfCurrentMenu

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

Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/swing/MenuSelectionManager.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : https://docs.oracle.com

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut