All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.JMenuItem

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----com.sun.java.swing.JComponent
                           |
                           +----com.sun.java.swing.AbstractButton
                                   |
                                   +----com.sun.java.swing.JMenuItem

public class JMenuItem
extends AbstractButton
implements Accessible
An implementation of a MenuItem


Constructor Index

 o JMenuItem()
Creates a menuItem with no set text or icon.
 o JMenuItem(Icon)
Creates a menuItem with an icon.
 o JMenuItem(String)
Creates a menuItem with text.
 o JMenuItem(String, Icon)
Creates a menuItem with the supplied text and icon.
 o JMenuItem(String, MenuShortcut)
Creates a menuItem using the supplied AWT MenuShortcut as the keyAccelerator

Method Index

 o deleteShortcut()
 o getAccessibleRole()
Get the role of this object.
 o getAccessibleStateSet()
Get the accessible state set of this object.
 o getShortcut()
 o getUIClassID()
 o init(String, Icon)
 o requestFocus()
Set focus on the receiving component if isRequestFocusEnabled returns true
 o setArmed(boolean)
 o setEnabled(boolean)
Enables (or disables) the button.
 o setShortcut(MenuShortcut)
 o setUI(MenuItemUI)
Sets the menuitem's UI.
 o updateUI()
Gets a new UI object from the default UIFactory.

Constructors

 o JMenuItem
 public JMenuItem()
Creates a menuItem with no set text or icon.

 o JMenuItem
 public JMenuItem(Icon icon)
Creates a menuItem with an icon.

Parameters:
icon - the icon of the MenuItem.
 o JMenuItem
 public JMenuItem(String text)
Creates a menuItem with text.

Parameters:
text - the text of the MenuItem.
 o JMenuItem
 public JMenuItem(String text,
                  Icon icon)
Creates a menuItem with the supplied text and icon.

Parameters:
text - the text of the MenuItem.
icon - the icon of the MenuItem.
 o JMenuItem
 public JMenuItem(String text,
                  MenuShortcut shortcut)
Creates a menuItem using the supplied AWT MenuShortcut as the keyAccelerator

Parameters:
text - the text of the MenuItem.
shortcut - the MenuShortcut for the menu

Methods

 o init
 protected void init(String text,
                     Icon icon)
Overrides:
init in class AbstractButton
 o setUI
 public void setUI(MenuItemUI ui)
Sets the menuitem's UI.

Parameters:
ui - the new MenuItemUI
See Also:
getUI
 o updateUI
 public void updateUI()
Gets a new UI object from the default UIFactory.

Overrides:
updateUI in class AbstractButton
 o getUIClassID
 public String getUIClassID()
Returns:
"MenuItemUI"
Overrides:
getUIClassID in class JComponent
See Also:
getUIClassID, getUI
 o requestFocus
 public void requestFocus()
Set focus on the receiving component if isRequestFocusEnabled returns true

Overrides:
requestFocus in class JComponent
 o setArmed
 public void setArmed(boolean b)
 o setEnabled
 public void setEnabled(boolean b)
Enables (or disables) the button.

Overrides:
setEnabled in class AbstractButton
 o deleteShortcut
 public void deleteShortcut()
 o setShortcut
 public void setShortcut(MenuShortcut s)
 o getShortcut
 public MenuShortcut getShortcut()
 o getAccessibleStateSet
 public AccessibleStateSet getAccessibleStateSet()
Get the accessible state set of this object.

Returns:
an instance of AccessibleState containing the current state of the object
Overrides:
getAccessibleStateSet in class AbstractButton
 o getAccessibleRole
 public AccessibleRole getAccessibleRole()
Get the role of this object.

Returns:
an instance of AccessibleRole describing the role of the object
Overrides:
getAccessibleRole in class JComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index