|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.droplets.api.MenuComponent | +--com.droplets.api.MenuItem
Represents items that can be placed in a Menu
. MenuItems
have a label (the text displayed on the menu), and an action command (an additional
string passed to listeners when events are fired by a menu item). Menu items
can be enabled or disabled using setEnabled(boolean)
.
Register for menu events for a MenuItem
by calling MenuComponent.addActionListener(com.droplets.api.event.ActionListener)
. The listener receives
ActionEvents
when the
menu item is selected.
Menus
and CheckboxMenuItems
are special
kinds of MenuItems
.
Constructor Summary | |
MenuItem()
Constructs a MenuItem with neither a label nor an action command. |
|
MenuItem(java.lang.String label)
Constructs a menu item with the specified label, but no action command. |
|
MenuItem(java.lang.String label,
java.lang.String actionCommand)
Constructs a menu item with the specified label and action command. |
Method Summary | |
java.lang.String |
getActionCommand()
Returns the action command string for this menu item. |
java.lang.String |
getLabel()
Returns the label of this menu item. |
boolean |
isEnabled()
Returns true if this menu item is currently enabled (i.e. |
void |
setActionCommand(java.lang.String command)
Sets the action command string for this menu item. |
void |
setEnabled(boolean isEnabled)
If isEnabled() is true, this menu item is made available for selection,
otherwise it is unavailable. |
void |
setLabel(java.lang.String label)
Sets the label of this menu item. |
Methods inherited from class com.droplets.api.MenuComponent |
addActionListener, getParent, removeActionListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MenuItem()
public MenuItem(java.lang.String label)
label
- the label for this menu item.public MenuItem(java.lang.String label, java.lang.String actionCommand)
label
- the label for this menu item.actionCommand
- the action command for this menu item.Method Detail |
public java.lang.String getActionCommand()
public java.lang.String getLabel()
public boolean isEnabled()
public void setActionCommand(java.lang.String command)
command
- java.lang.Stringpublic void setEnabled(boolean isEnabled)
isEnabled()
is true, this menu item is made available for selection,
otherwise it is unavailable. Menu items are enabled by default.isEnabled
- booleanpublic void setLabel(java.lang.String label)
label
- java.lang.String
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |