MenuItem
An item that performs an action when the user picks it: a JMenuItem reporting the pick through onClick.
Parameters
the text of the menu item
callback to be invoked when the menu item is clicked
the SwingModifier applied to the underlying component
the key combination that activates the item without navigating the menu hierarchy, displayed next to its text; null (the default) leaves the item without one
See also
A JMenuItem driven by a raw ActionListener instead of an onClick lambda. The listener is attached as-is and removed on the same instance; pass a stable instance (e.g. remember {}) to avoid churn.
Parameters
the text of the menu item
the listener notified when the item is activated
the SwingModifier applied to the underlying component
the key combination that activates the item without navigating the menu hierarchy, displayed next to its text; null (the default) leaves the item without one