MenuElement (Java SE 15 & JDK 15) (original) (raw)
All Known Implementing Classes:
[BasicComboPopup](plaf/basic/BasicComboPopup.html "class in javax.swing.plaf.basic")
, [BasicInternalFrameTitlePane.SystemMenuBar](plaf/basic/BasicInternalFrameTitlePane.SystemMenuBar.html "class in javax.swing.plaf.basic")
, [JCheckBoxMenuItem](JCheckBoxMenuItem.html "class in javax.swing")
, [JMenu](JMenu.html "class in javax.swing")
, [JMenuBar](JMenuBar.html "class in javax.swing")
, [JMenuItem](JMenuItem.html "class in javax.swing")
, [JPopupMenu](JPopupMenu.html "class in javax.swing")
, [JRadioButtonMenuItem](JRadioButtonMenuItem.html "class in javax.swing")
, [MetalComboBoxUI.MetalComboPopup](plaf/metal/MetalComboBoxUI.MetalComboPopup.html "class in javax.swing.plaf.metal")
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.
Since:
1.2
Method Summary
Modifier and Type | Method | Description |
---|---|---|
Component | getComponent() | This method should return the java.awt.Component used to paint the receiving element. |
MenuElement[] | getSubElements() | This method should return an array containing the sub-elements for the receiving menu element. |
void | menuSelectionChanged(boolean isIncluded) | Call by the MenuSelectionManager when the MenuElement is added or removed from the menu selection. |
void | processKeyEvent(KeyEvent event,MenuElement[] path,MenuSelectionManager manager) | Process a key event. |
void | processMouseEvent(MouseEvent event,MenuElement[] path,MenuSelectionManager manager) | Processes a mouse event. |
Method Details
getSubElements
This method should return an array containing the sub-elements for the receiving menu element.
Returns:
an array ofMenuElement
sgetComponent
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 aMenuElement
's component.
Returns:
theComponent
value