Example usage for Java javax.swing JMenuItem fields, constructors, methods, implement or subclass
The text is from its open source code.
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. |
Component | add(Component comp) Appends the specified component to the end of this container. |
void | addActionListener(ActionListener l) Adds an ActionListener to the button. |
void | addChangeListener(ChangeListener l) Adds a ChangeListener to the button. |
void | addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component. |
void | addItemListener(ItemListener l) Adds an ItemListener to the checkbox . |
void | addMenuDragMouseListener(MenuDragMouseListener l) Adds a MenuDragMouseListener to the menu item. |
void | addMenuKeyListener(MenuKeyListener l) Adds a MenuKeyListener to the menu item. |
void | addMouseListener(MouseListener l) Adds the specified mouse listener to receive mouse events from this component. |
void | addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component. |
void | addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list. |
void | doClick() Programmatically perform a "click". |
boolean | equals(Object obj) Indicates whether some other object is "equal to" this one. |
KeyStroke | getAccelerator() Returns the KeyStroke which serves as an accelerator for the menu item. |
AccessibleContext | getAccessibleContext() Returns the AccessibleContext associated with this JMenuItem . |
Action | getAction() Returns the currently set Action for this ActionEvent source, or null if no Action is set. |
String | getActionCommand() Returns the action command for this button. |
ActionListener[] | getActionListeners() Returns an array of all the ActionListener s added to this AbstractButton with addActionListener(). |
Object | getClientProperty(Object key) Returns the value of the property with the specified key. |
Font | getFont() Gets the font of this component. |
Icon | getIcon() Returns the default icon. |
InputMap | getInputMap(int condition) Returns the InputMap that is used during condition . |
T[] | getListeners(Class Returns an array of all the objects currently registered as FooListener s upon this JComponent . |
Dimension | getMaximumSize() If the maximum size has been set to a non- null value just returns it. |
int | getMnemonic() Returns the keyboard mnemonic from the current model. |
ButtonModel | getModel() Returns the model that this button represents. |
String | getName() Gets the name of the component. |
Container | getParent() Gets the parent of this component. |
Dimension | getPreferredSize() If the preferredSize has been set to a non-null value just returns it. |
String | getText() Returns the button's text. |
String | getToolTipText() Returns the tooltip string that has been set with setToolTipText . |
boolean | isArmed() Returns whether the menu item is "armed". |
boolean | isEnabled() Determines whether this component is enabled. |
boolean | isSelected() Returns the state of the button. |
boolean | isVisible() Determines whether this component should be visible when its parent is visible. |
void | putClientProperty(Object key, Object value) Adds an arbitrary key/value "client property" to this component. |
void | removeActionListener(ActionListener l) Removes an ActionListener from the button. |
void | repaint() Repaints this component. |
void | setAccelerator(KeyStroke keyStroke) Sets the key combination which invokes the menu item's action listeners without navigating the menu hierarchy. |
void | setAction(Action a) Sets the Action . |
void | setActionCommand(String actionCommand) Sets the action command for this button. |
void | setArmed(boolean b) Identifies the menu item as "armed". |
void | setBackground(Color bg) Sets the background color of this component. |
void | setBorder(Border border) Sets the border of this component. |
void | setCursor(Cursor cursor) Sets the cursor image to the specified cursor. |
void | setDisabledIcon(Icon disabledIcon) Sets the disabled icon for the button. |
void | setEnabled(boolean b) Enables or disables the menu item. |
void | setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value. |
void | setFont(Font font) Sets the font for this component. |
void | setForeground(Color fg) Sets the foreground color of this component. |
void | setHorizontalTextPosition(int textPosition) Sets the horizontal position of the text relative to the icon. |
void | setIcon(Icon defaultIcon) Sets the button's default icon. |
void | setInputMap(int condition, InputMap map) Sets the InputMap to use under the condition condition to map . |
void | setLayout(LayoutManager mgr) Sets the layout manager for this container, refer to java.awt.Container#setLayout(LayoutManager) for a complete description of this method. |
void | setMargin(Insets m) Sets space for margin between the button's border and the label. |
void | setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value. |
void | setMnemonic(int mnemonic) Sets the keyboard mnemonic on the current model. |
void | setModel(ButtonModel newModel) |
void | setName(String name) Sets the name of the component to the specified string. |
void | setOpaque(boolean isOpaque) If true the component paints every pixel within its bounds. |
void | setPreferredSize(Dimension preferredSize) Sets the preferred size of this component. |
void | setSelected(boolean b) Sets the state of the button. |
void | setText(String text) Sets the button's text. |
void | setToolTipText(String text) Registers the text to display in a tool tip. |
void | setTransferHandler(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. |
void | setVerticalTextPosition(int textPosition) Sets the vertical position of the text relative to the icon. |
void | setVisible(boolean aFlag) Makes the component visible or invisible. |