|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.awt.Component
![]()
![]()
![]()
java.awt.Container
![]()
![]()
![]()
javax.swing.JComponent
![]()
![]()
![]()
javax.swing.AbstractButton
![]()
![]()
![]()
javax.swing.JMenuItem
, ItemSelectable
, MenuContainer
, Serializable
, Accessible
, MenuElement
, SwingConstants

, JMenu
, JRadioButtonMenuItem

public class JMenuItem

, MenuElement

An implementation of an item in a menu. A menu item is essentially a button
sitting in a list. When the user selects the "button", the action
associated with the menu item is performed. A JMenuItem
contained in a JPopupMenu performs exactly that function.
For further documentation and for examples, see How to Use Menus in The Java Tutorial.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see XMLEncoder
.
JPopupMenu
,
JMenu
,
JCheckBoxMenuItem
,
JRadioButtonMenuItem
,
Serialized Form| Nested Class Summary | |
|---|---|
protected class |
JMenuItem.AccessibleJMenuItem
This class implements accessibility support for the JMenuItem class. |
Nested classes/interfaces inherited from class javax.swing.AbstractButton ![]() |
|---|
AbstractButton.AccessibleAbstractButton |
Nested classes/interfaces inherited from class javax.swing.JComponent ![]() |
|---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container ![]() |
|---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component ![]() |
|---|
Component.AccessibleAWTComponent |
| Field Summary |
|---|
Fields inherited from class javax.swing.JComponent ![]() |
|---|
accessibleContext |
Fields inherited from class java.awt.Component ![]() |
|---|
BOTTOM_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants ![]() |
|---|
BOTTOM |
Fields inherited from interface java.awt.image.ImageObserver ![]() |
|---|
ABORT |
| Constructor Summary | |
|---|---|
JMenuItem
Creates a JMenuItem with no set text or icon. |
|
JMenuItem
Creates a menu item whose properties are taken from the specified Action. |
|
JMenuItem
Creates a JMenuItem with the specified icon. |
|
JMenuItem
Creates a JMenuItem with the specified text. |
|
JMenuItem
Creates a JMenuItem with the specified text and icon. |
|
JMenuItem
Creates a JMenuItem with the specified text and
keyboard mnemonic. |
|
| Method Summary | |
|---|---|
void |
addMenuDragMouseListener
Adds a MenuDragMouseListener to the menu item. |
void |
addMenuKeyListener
Adds a MenuKeyListener to the menu item. |
protected void |
configurePropertiesFromAction
Factory method which sets the ActionEvent source's
properties according to values from the Action instance. |
protected PropertyChangeListener |
createActionPropertyChangeListener
Factory method which creates the PropertyChangeListener
used to update the ActionEvent source as properties
change on its Action instance. |
protected void |
fireMenuDragMouseDragged
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireMenuDragMouseEntered
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireMenuDragMouseExited
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireMenuDragMouseReleased
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireMenuKeyPressed
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireMenuKeyReleased
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireMenuKeyTyped
Notifies all listeners that have registered interest for notification on this event type. |
KeyStroke |
getAccelerator
Returns the KeyStroke which serves as an accelerator
for the menu item. |
AccessibleContext |
getAccessibleContext
Returns the AccessibleContext associated with this
JMenuItem. |
Component |
getComponent
Returns the java.awt.Component used to paint
this object. |
MenuDragMouseListener |
getMenuDragMouseListeners
Returns an array of all the MenuDragMouseListeners added
to this JMenuItem with addMenuDragMouseListener(). |
MenuKeyListener |
getMenuKeyListeners
Returns an array of all the MenuKeyListeners added
to this JMenuItem with addMenuKeyListener(). |
MenuElement |
getSubElements
This method returns an array containing the sub-menu components for this menu component. |
String |
getUIClassID
Returns the suffix used to construct the name of the L&F class used to render this component. |
protected void |
init
Initializes the menu item with the specified text and icon. |
boolean |
isArmed
Returns whether the menu item is "armed". |
void |
menuSelectionChanged
Called by the MenuSelectionManager when the
MenuElement is selected or unselected. |
protected String |
paramString
Returns a string representation of this JMenuItem. |
void |
processKeyEvent |