This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing
class JMenuItem

java.lang.Object extended by java.awt.Component extended by java.awt.Container extended by javax.swing.JComponent extended by javax.swing.AbstractButton extended by javax.swing.JMenuItem
All Implemented Interfaces:
ItemSelectable, MenuContainer, ImageObserver, Serializable, Accessible, MenuElement, SwingConstants, TransferHandler.HasGetTransferHandler
Direct Known Subclasses:
JCheckBoxMenuItem, JMenu, JRadioButtonMenuItem

Most common way to construct:

JMenuItem item = new JMenuItem("Exit");

Based on 99 examples


public class JMenuItem
extends AbstractButton
implements Accessible, 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.

Menu items can be configured, and to some degree controlled, by Actions. Using an Action with a menu item has many benefits beyond directly configuring a menu item. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

For further documentation and for examples, see How to Use Menus in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

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 {@link java.beans.XMLEncoder}.


Nested Class Summary
protected class

           This class implements accessibility support for the JMenuItem class.
Nested classes/interfaces inherited from class javax.swing.AbstractButton
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
 
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, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
   
Field Summary
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary

          Creates a JMenuItem with no set text or icon.

          Creates a menu item whose properties are taken from the specified Action.

          Creates a JMenuItem with the specified icon.

          Creates a JMenuItem with the specified text.
JMenuItem(String text, Icon icon)

          Creates a JMenuItem with the specified text and icon.
JMenuItem(String text, int mnemonic)

          Creates a JMenuItem with the specified text and keyboard mnemonic.
 
Method Summary
protected void
actionPropertyChanged(Action action, String propertyName)

          Updates the button's state in response to property changes in the associated action.
 void

          Adds a MenuDragMouseListener to the menu item.
 void

          Adds a MenuKeyListener to the menu item.
protected void

          Sets the properties on this button to match those in the specified Action.
protected void

          Notifies all listeners that have registered interest for notification on this event type.
protected void

          Notifies all listeners that have registered interest for notification on this event type.
protected void

          Notifies all listeners that have registered interest for notification on this event type.
protected void

          Notifies all listeners that have registered interest for notification on this event type.
protected void

          Notifies all listeners that have registered interest for notification on this event type.
protected void

          Notifies all listeners that have registered interest for notification on this event type.
protected void

          Notifies all listeners that have registered interest for notification on this event type.
 KeyStroke

          Returns the KeyStroke which serves as an accelerator for the menu item.
 AccessibleContext

          Returns the AccessibleContext associated with this JMenuItem.
 Component

          Returns the java.awt.Component used to paint this object.
 MenuDragMouseListener[]

          Returns an array of all the MenuDragMouseListeners added to this JMenuItem with addMenuDragMouseListener().
 MenuKeyListener[]

          Returns an array of all the MenuKeyListeners added to this JMenuItem with addMenuKeyListener().
 MenuElement[]

          This method returns an array containing the sub-menu components for this menu component.
 String

          Returns the suffix used to construct the name of the L&F class used to render this component.
protected void
init(String text, Icon icon)

          Initializes the menu item with the specified text and icon.
 boolean

          Returns whether the menu item is "armed".
 void
menuSelectionChanged(boolean isIncluded)

          Called by the MenuSelectionManager when the MenuElement is selected or unselected.
protected String

          Returns a string representation of this JMenuItem.
 void

          Processes a key event forwarded from the MenuSelectionManager and changes the menu selection, if necessary, by using MenuSelectionManager's API.
 void

          Handles mouse drag in a menu.
 void

          Handles a keystroke in a menu.
 void

          Processes a mouse event forwarded from the MenuSelectionManager and changes the menu selection, if necessary, by using the MenuSelectionManager's API.
 void

          Removes a MenuDragMouseListener from the menu item.
 void

          Removes a MenuKeyListener from the menu item.
 void

          Sets the key combination which invokes the menu item's action listeners without navigating the menu hierarchy.
 void
setArmed(boolean b)

          Identifies the menu item as "armed".
 void
setEnabled(boolean b)

          Enables or disables the menu item.
 void

          Sets the model that this button represents.
 void

          Sets the look and feel object that renders this component.
 void

          Resets the UI property with a value from the current look and feel.
 
Methods inherited from class javax.swing.AbstractButton
actionPropertyChanged, addActionListener, addChangeListener, addImpl, addItemListener, check, checkHorizontalKey, checkVerticalKey, configurePropertiesFromAction, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, paramString, removeActionListener, removeChangeListener, removeItemListener, removeNotify, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMenuItem

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


JMenuItem

public JMenuItem(Action a)
Creates a menu item whose properties are taken from the specified Action.

Parameters:
a - the action of the JMenuItem

JMenuItem

public JMenuItem(Icon icon)
Creates a JMenuItem with the specified icon.

Parameters:
icon - the icon of the JMenuItem

JMenuItem

public JMenuItem(String text)
Creates a JMenuItem with the specified text.

Parameters:
text - the text of the JMenuItem

JMenuItem

public JMenuItem(String text,
                 Icon icon)
Creates a JMenuItem with the specified text and icon.

Parameters:
text - the text of the JMenuItem
icon - the icon of the JMenuItem

JMenuItem

public JMenuItem(String text,
                 int mnemonic)
Creates a JMenuItem with the specified text and keyboard mnemonic.

Parameters:
text - the text of the JMenuItem
mnemonic - the keyboard mnemonic for the JMenuItem
Method Detail

actionPropertyChanged

protected void actionPropertyChanged(Action action,
                                     String propertyName)
{@inheritDoc}

Overrides:
actionPropertyChanged in class AbstractButton
Parameters:
action
propertyName

addMenuDragMouseListener

public void addMenuDragMouseListener(MenuDragMouseListener l)
Adds a MenuDragMouseListener to the menu item.

Parameters:
l - the MenuDragMouseListener to be added

addMenuKeyListener

public void addMenuKeyListener(MenuKeyListener l)
Adds a MenuKeyListener to the menu item.

Parameters:
l - the MenuKeyListener to be added

configurePropertiesFromAction

protected void configurePropertiesFromAction(Action a)
{@inheritDoc}

Overrides:
configurePropertiesFromAction in class AbstractButton
Parameters:
a

fireMenuDragMouseDragged

protected void fireMenuDragMouseDragged(MenuDragMouseEvent event)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
event - a MenuDragMouseEvent

fireMenuDragMouseEntered

protected void fireMenuDragMouseEntered(MenuDragMouseEvent event)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
event - a MenuMouseDragEvent

fireMenuDragMouseExited

protected void fireMenuDragMouseExited(MenuDragMouseEvent event)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
event - a MenuDragMouseEvent

fireMenuDragMouseReleased

protected void fireMenuDragMouseReleased(MenuDragMouseEvent event)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
event - a MenuDragMouseEvent

fireMenuKeyPressed

protected void fireMenuKeyPressed(MenuKeyEvent event)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
event - a MenuKeyEvent

fireMenuKeyReleased

protected void fireMenuKeyReleased(MenuKeyEvent event)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
event - a MenuKeyEvent

fireMenuKeyTyped

protected void fireMenuKeyTyped(MenuKeyEvent event)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
event - a MenuKeyEvent

getAccelerator

public KeyStroke getAccelerator()
Returns the KeyStroke which serves as an accelerator for the menu item.

Returns:
a KeyStroke object identifying the accelerator key

getAccessibleContext

public AccessibleContext getAccessibleContext()
Returns the AccessibleContext associated with this JMenuItem. For JMenuItems, the AccessibleContext takes the form of an AccessibleJMenuItem. A new AccessibleJMenuItme instance is created if necessary.

Overrides:
getAccessibleContext in class JComponent
Returns:
an AccessibleJMenuItem that serves as the AccessibleContext of this JMenuItem

getComponent

public Component getComponent()
Returns the java.awt.Component used to paint this object. The returned component will be used to convert events and detect if an event is inside a menu component.

Returns:
the Component that paints this menu item

getMenuDragMouseListeners

public MenuDragMouseListener[] getMenuDragMouseListeners()
Returns an array of all the MenuDragMouseListeners added to this JMenuItem with addMenuDragMouseListener().

Returns:
all of the MenuDragMouseListeners added or an empty array if no listeners have been added

getMenuKeyListeners

public MenuKeyListener[] getMenuKeyListeners()
Returns an array of all the MenuKeyListeners added to this JMenuItem with addMenuKeyListener().

Returns:
all of the MenuKeyListeners added or an empty array if no listeners have been added

getSubElements

public MenuElement[] getSubElements()
This method returns an array containing the sub-menu components for this menu component.

Returns:
an array of MenuElements

getUIClassID

public String getUIClassID()
Returns the suffix used to construct the name of the L&F class used to render this component.

Overrides:
getUIClassID in class JComponent
Returns:
the string "MenuItemUI"

init

protected void init(String text,
                    Icon icon)
Initializes the menu item with the specified text and icon.

Overrides:
init in class AbstractButton
Parameters:
text - the text of the JMenuItem
icon - the icon of the JMenuItem

isArmed

public boolean isArmed()
Returns whether the menu item is "armed".

Returns:
true if the menu item is armed, and it can be selected

menuSelectionChanged

public void menuSelectionChanged(boolean isIncluded)
Called by the MenuSelectionManager when the MenuElement is selected or unselected.

Parameters:
isIncluded - true if this menu item is on the part of the menu path that changed, false if this menu is part of the a menu path that changed, but this particular part of that path is still the same

paramString

protected String paramString()
Returns a string representation of this JMenuItem. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
paramString in class AbstractButton
Returns:
a string representation of this JMenuItem

processKeyEvent

public void processKeyEvent(KeyEvent e,
                            MenuElement[] path,
                            MenuSelectionManager manager)
Processes a key event forwarded from the MenuSelectionManager and changes 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.

Parameters:
e - a KeyEvent
path - the MenuElement path array
manager - the MenuSelectionManager

processMenuDragMouseEvent

public void processMenuDragMouseEvent(MenuDragMouseEvent e)
Handles mouse drag in a menu.

Parameters:
e - a MenuDragMouseEvent object

processMenuKeyEvent

public void processMenuKeyEvent(MenuKeyEvent e)
Handles a keystroke in a menu.

Parameters:
e - a MenuKeyEvent object

processMouseEvent

public void processMouseEvent(MouseEvent e,
                              MenuElement[] path,
                              MenuSelectionManager manager)
Processes a mouse event forwarded from the MenuSelectionManager and changes the menu selection, if necessary, by using the MenuSelectionManager's API.

Note: you do not have to forward the event to sub-components. This is done automatically by the MenuSelectionManager.

Parameters:
e - a MouseEvent
path - the MenuElement path array
manager - the MenuSelectionManager

removeMenuDragMouseListener

public void removeMenuDragMouseListener(MenuDragMouseListener l)
Removes a MenuDragMouseListener from the menu item.

Parameters:
l - the MenuDragMouseListener to be removed

removeMenuKeyListener

public void removeMenuKeyListener(MenuKeyListener l)
Removes a MenuKeyListener from the menu item.

Parameters:
l - the MenuKeyListener to be removed

setAccelerator

public void setAccelerator(KeyStroke keyStroke)
Sets the key combination which invokes the menu item's action listeners without navigating the menu hierarchy. It is the UI's responsibility to install the correct action. Note that when the keyboard accelerator is typed, it will work whether or not the menu is currently displayed.

Parameters:
keyStroke - the KeyStroke which will serve as an accelerator

setArmed

public void setArmed(boolean b)
Identifies the menu item as "armed". If the mouse button is released while it is over this item, the menu's action event will fire. If the mouse button is released elsewhere, the event will not fire and the menu item will be disarmed.

Parameters:
b - true to arm the menu item so it can be selected

setEnabled

public void setEnabled(boolean b)
Enables or disables the menu item.

Overrides:
setEnabled in class AbstractButton
Parameters:
b - true to enable the item

setModel

public void setModel(ButtonModel newModel)
{@inheritDoc}

Overrides:
setModel in class AbstractButton
Parameters:
newModel

setUI

public void setUI(MenuItemUI ui)
Sets the look and feel object that renders this component.

Parameters:
ui - the JMenuItemUI L&F object

updateUI

public void updateUI()
Resets the UI property with a value from the current look and feel.

Overrides:
updateUI in class AbstractButton


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.