Java javax.swing JMenuItem fields, constructors, methods, implement or subclass

Example usage for Java javax.swing JMenuItem fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for javax.swing JMenuItem.

The text is from its open source code.

Subclass

javax.swing.JMenuItem has subclasses.
Click this link to see all its subclasses.

Constructor

JMenuItem(Icon icon)
Creates a JMenuItem with the specified icon.
JMenuItem(String text)
Creates a JMenuItem with the specified text.
JMenuItem(Action a)
Creates a menu item whose properties are taken from the specified Action.
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.
JMenuItem()
Creates a JMenuItem with no set text or icon.

Method

Componentadd(Component comp)
Appends the specified component to the end of this container.
voidaddActionListener(ActionListener l)
Adds an ActionListener to the button.
voidaddChangeListener(ChangeListener l)
Adds a ChangeListener to the button.
voidaddComponentListener(ComponentListener l)
Adds the specified component listener to receive component events from this component.
voidaddItemListener(ItemListener l)
Adds an ItemListener to the checkbox.
voidaddMenuDragMouseListener(MenuDragMouseListener l)
Adds a MenuDragMouseListener to the menu item.
voidaddMenuKeyListener(MenuKeyListener l)
Adds a MenuKeyListener to the menu item.
voidaddMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this component.
voidaddMouseMotionListener(MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component.
voidaddPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.
voiddoClick()
Programmatically perform a "click".
booleanequals(Object obj)
Indicates whether some other object is "equal to" this one.
KeyStrokegetAccelerator()
Returns the KeyStroke which serves as an accelerator for the menu item.
AccessibleContextgetAccessibleContext()
Returns the AccessibleContext associated with this JMenuItem.
ActiongetAction()
Returns the currently set Action for this ActionEvent source, or null if no Action is set.
StringgetActionCommand()
Returns the action command for this button.
ActionListener[]getActionListeners()
Returns an array of all the ActionListeners added to this AbstractButton with addActionListener().
ObjectgetClientProperty(Object key)
Returns the value of the property with the specified key.
FontgetFont()
Gets the font of this component.
IcongetIcon()
Returns the default icon.
InputMapgetInputMap(int condition)
Returns the InputMap that is used during condition.
T[]getListeners(Class listenerType)
Returns an array of all the objects currently registered as FooListeners upon this JComponent.
DimensiongetMaximumSize()
If the maximum size has been set to a non-null value just returns it.
intgetMnemonic()
Returns the keyboard mnemonic from the current model.
ButtonModelgetModel()
Returns the model that this button represents.
StringgetName()
Gets the name of the component.
ContainergetParent()
Gets the parent of this component.
DimensiongetPreferredSize()
If the preferredSize has been set to a non-null value just returns it.
StringgetText()
Returns the button's text.
StringgetToolTipText()
Returns the tooltip string that has been set with setToolTipText.
booleanisArmed()
Returns whether the menu item is "armed".
booleanisEnabled()
Determines whether this component is enabled.
booleanisSelected()
Returns the state of the button.
booleanisVisible()
Determines whether this component should be visible when its parent is visible.
voidputClientProperty(Object key, Object value)
Adds an arbitrary key/value "client property" to this component.
voidremoveActionListener(ActionListener l)
Removes an ActionListener from the button.
voidrepaint()
Repaints this component.
voidsetAccelerator(KeyStroke keyStroke)
Sets the key combination which invokes the menu item's action listeners without navigating the menu hierarchy.
voidsetAction(Action a)
Sets the Action.
voidsetActionCommand(String actionCommand)
Sets the action command for this button.
voidsetArmed(boolean b)
Identifies the menu item as "armed".
voidsetBackground(Color bg)
Sets the background color of this component.
voidsetBorder(Border border)
Sets the border of this component.
voidsetCursor(Cursor cursor)
Sets the cursor image to the specified cursor.
voidsetDisabledIcon(Icon disabledIcon)
Sets the disabled icon for the button.
voidsetEnabled(boolean b)
Enables or disables the menu item.
voidsetFocusable(boolean focusable)
Sets the focusable state of this Component to the specified value.
voidsetFont(Font font)
Sets the font for this component.
voidsetForeground(Color fg)
Sets the foreground color of this component.
voidsetHorizontalTextPosition(int textPosition)
Sets the horizontal position of the text relative to the icon.
voidsetIcon(Icon defaultIcon)
Sets the button's default icon.
voidsetInputMap(int condition, InputMap map)
Sets the InputMap to use under the condition condition to map.
voidsetLayout(LayoutManager mgr)
Sets the layout manager for this container, refer to java.awt.Container#setLayout(LayoutManager) for a complete description of this method.
voidsetMargin(Insets m)
Sets space for margin between the button's border and the label.
voidsetMaximumSize(Dimension maximumSize)
Sets the maximum size of this component to a constant value.
voidsetMnemonic(int mnemonic)
Sets the keyboard mnemonic on the current model.
voidsetModel(ButtonModel newModel)
voidsetName(String name)
Sets the name of the component to the specified string.
voidsetOpaque(boolean isOpaque)
If true the component paints every pixel within its bounds.
voidsetPreferredSize(Dimension preferredSize)
Sets the preferred size of this component.
voidsetSelected(boolean b)
Sets the state of the button.
voidsetText(String text)
Sets the button's text.
voidsetToolTipText(String text)
Registers the text to display in a tool tip.
voidsetTransferHandler(TransferHandler newHandler)
Sets the TransferHandler , which provides support for transfer of data into and out of this component via cut/copy/paste and drag and drop.
voidsetVerticalTextPosition(int textPosition)
Sets the vertical position of the text relative to the icon.
voidsetVisible(boolean aFlag)
Makes the component visible or invisible.