javax.swing
Interface MenuElement

All Known Implementing Classes:
BasicComboPopup sample code for javax.swing.plaf.basic.BasicComboPopup definition code for javax.swing.plaf.basic.BasicComboPopup , BasicInternalFrameTitlePane.SystemMenuBar sample code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.SystemMenuBar definition code for javax.swing.plaf.basic.BasicInternalFrameTitlePane.SystemMenuBar , JCheckBoxMenuItem sample code for javax.swing.JCheckBoxMenuItem definition code for javax.swing.JCheckBoxMenuItem , JMenu sample code for javax.swing.JMenu definition code for javax.swing.JMenu , JMenuBar sample code for javax.swing.JMenuBar definition code for javax.swing.JMenuBar , JMenuItem sample code for javax.swing.JMenuItem definition code for javax.swing.JMenuItem , JPopupMenu sample code for javax.swing.JPopupMenu definition code for javax.swing.JPopupMenu , JRadioButtonMenuItem sample code for javax.swing.JRadioButtonMenuItem definition code for javax.swing.JRadioButtonMenuItem , MetalComboBoxUI.MetalComboPopup sample code for javax.swing.plaf.metal.MetalComboBoxUI.MetalComboPopup definition code for javax.swing.plaf.metal.MetalComboBoxUI.MetalComboPopup

public interface MenuElement

Any component that can be placed into a menu should implement this interface. This interface is used by MenuSelectionManager to handle selection and navigation in menu hierarchies.


Method Summary
 Component sample code for java.awt.Component definition code for java.awt.Component getComponent sample code for javax.swing.MenuElement.getComponent() definition code for javax.swing.MenuElement.getComponent() ()
          This method should return the java.awt.Component used to paint the receiving element.
 MenuElement sample code for javax.swing.MenuElement definition code for javax.swing.MenuElement [] getSubElements sample code for javax.swing.MenuElement.getSubElements() definition code for javax.swing.MenuElement.getSubElements() ()
          This method should return an array containing the sub-elements for the receiving menu element
 void menuSelectionChanged sample code for javax.swing.MenuElement.menuSelectionChanged(boolean) definition code for javax.swing.MenuElement.menuSelectionChanged(boolean) (boolean isIncluded)
          Call by the MenuSelectionManager when the MenuElement is added or remove from the menu selection.
 void processKeyEvent sample code for javax.swing.MenuElement.processKeyEvent(java.awt.event.KeyEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager) definition code for javax.swing.MenuElement.processKeyEvent(java.awt.event.KeyEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager) (KeyEvent sample code for java.awt.event.KeyEvent definition code for java.awt.event.KeyEvent  event, MenuElement sample code for javax.swing.MenuElement definition code for javax.swing.MenuElement [] path, MenuSelectionManager sample code for javax.swing.MenuSelectionManager definition code for javax.swing.MenuSelectionManager  manager)
          Process a key event.
 void processMouseEvent sample code for javax.swing.MenuElement.processMouseEvent(java.awt.event.MouseEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager) definition code for javax.swing.MenuElement.processMouseEvent(java.awt.event.MouseEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager) (MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  event, MenuElement sample code for javax.swing.MenuElement definition code for javax.swing.MenuElement [] path, MenuSelectionManager sample code for javax.swing.MenuSelectionManager definition code for javax.swing.MenuSelectionManager  manager)
          Processes a mouse event.
 

Method Detail

processMouseEvent sample code for javax.swing.MenuElement.processMouseEvent(java.awt.event.MouseEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager) definition code for javax.swing.MenuElement.processMouseEvent(java.awt.event.MouseEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager)

void processMouseEvent(MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  event,
                       MenuElement sample code for javax.swing.MenuElement definition code for javax.swing.MenuElement [] path,
                       MenuSelectionManager sample code for javax.swing.MenuSelectionManager definition code for javax.swing.MenuSelectionManager  manager)
Processes a mouse event. event is a MouseEvent with source being the receiving element's component. path is the path of the receiving element in the menu hierarchy including the receiving element itself. manager is the MenuSelectionManager for the menu hierarchy. This method should process the MouseEvent and change the menu selection if necessary by using MenuSelectionManager's API Note: you do not have to forward the event to sub-components. This is done automatically by the MenuSelectionManager.


processKeyEvent sample code for javax.swing.MenuElement.processKeyEvent(java.awt.event.KeyEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager) definition code for javax.swing.MenuElement.processKeyEvent(java.awt.event.KeyEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager)

void processKeyEvent(KeyEvent sample code for java.awt.event.KeyEvent definition code for java.awt.event.KeyEvent  event,
                     MenuElement sample code for javax.swing.MenuElement definition code for javax.swing.MenuElement [] path,
                     MenuSelectionManager sample code for javax.swing.MenuSelectionManager definition code for javax.swing.MenuSelectionManager  manager)
Process a key event.


menuSelectionChanged sample code for javax.swing.MenuElement.menuSelectionChanged(boolean) definition code for javax.swing.MenuElement.menuSelectionChanged(boolean)

void menuSelectionChanged(boolean isIncluded)
Call by the MenuSelectionManager when the MenuElement is added or remove from the menu selection.


getSubElements sample code for javax.swing.MenuElement.getSubElements() definition code for javax.swing.MenuElement.getSubElements()

MenuElement sample code for javax.swing.MenuElement definition code for javax.swing.MenuElement [] getSubElements()
This method should return an array containing the sub-elements for the receiving menu element

Returns:
an array of MenuElements

getComponent sample code for javax.swing.MenuElement.getComponent() definition code for javax.swing.MenuElement.getComponent()

Component sample code for java.awt.Component definition code for java.awt.Component  getComponent()
This method should return the java.awt.Component used to paint the receiving element. The returned component will be used to convert events and detect if an event is inside a MenuElement's component.

Returns:
the Component value