The CheckboxMenuItem class represents a menu item with a boolean state.
public class java.awt.CheckboxMenuItem extends java.awt.MenuItem implements java.awt.ItemSelectable { // Constructors public CheckboxMenuItem(); public CheckboxMenuItem (String label); public CheckboxMenuItem (String label, boolean state); // Instance Methods public void addItemListener (ItemListener l); public void addNotify(); public Object[] getSelectedObjects(); public boolean getState(); public String paramString(); public void removeItemListener (ItemListener l); public synchronized void setState (boolean condition); // Protected Instance Methods protected void processEvent (AWTEvent e); protected void processItemEvent (ItemEvent e); }
Constructs a CheckboxMenuItem object with no label.
Text that appears on CheckboxMenuItem.
Constructs a CheckboxMenuItem object whose value is initially false.
Text that appears on CheckboxMenuItem.
The initial state of the menu item.
Constructs a CheckboxMenuItem object with the specified label and state.
The listener to be added.
ItemSelectable.addItemListener(ItemListener l)
Adds a listener for the ItemEvent objects this CheckboxMenuItem fires off.
MenuItem.addNotify()
Creates CheckboxMenuItem's peer.
ItemSelectable.getSelectedObjects()
If the CheckboxMenuItem is checked, returns an array with length 1 containing the label of the CheckboxMenuItem; otherwise returns null.
The current state of the CheckboxMenuItem.
A string with current settings of CheckboxMenuItem.
MenuItem.paramString()
Helper method for toString() to generate string of current settings.
The listener to be removed.
ItemSelectable.removeItemListener (ItemListener l)
Removes the specified ItemListener so it will not receive ItemEvent objects from this CheckboxMenuItem.
New state for the CheckboxMenuItem.
Changes the state of the CheckboxMenuItem.
The event to process.
MenuItem.processEvent(AWTEvent)
Low level AWTEvents are passed to this method for processing.
The item event to process.
Item events are passed to this method for processing. Normally, this method is called by processEvent().
ItemEvent, ItemSelectable, MenuItem, String