|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.itmill.toolkit.ui.MenuBar.MenuItem
public class MenuBar.MenuItem
A composite class for menu items and sub-menus. You can set commands to
be fired on user click by implementing the
MenuBar.Command
interface. You can also add
multiple MenuItems to a MenuItem and create a sub-menu.
Constructor Summary | |
---|---|
MenuBar.MenuItem(String caption,
Resource icon,
MenuBar.Command command)
Constructs a new menu item that can optionally have an icon and a command associated with it. |
Method Summary | |
---|---|
MenuBar.MenuItem |
addItem(String caption,
MenuBar.Command command)
Add a new item inside this item, thus creating a sub-menu. |
MenuBar.MenuItem |
addItem(String caption,
Resource icon,
MenuBar.Command command)
Add a new item inside this item, thus creating a sub-menu. |
MenuBar.MenuItem |
addItemBefore(String caption,
Resource icon,
MenuBar.Command command,
MenuBar.MenuItem itemToAddBefore)
Add an item before some item. |
List<MenuBar.MenuItem> |
getChildren()
This will return the children of this item or null if there are none. |
MenuBar.Command |
getCommand()
For the associated command. |
Resource |
getIcon()
Gets the objects icon. |
int |
getId()
Get the unique identifier for this item. |
MenuBar.MenuItem |
getParent()
For the containing item. |
int |
getSize()
Returns the number of children. |
String |
getText()
Gets the objects text |
boolean |
hasChildren()
Checks if the item has children (if it is a sub-menu). |
void |
removeChild(MenuBar.MenuItem item)
Remove the first occurrence of the item. |
void |
removeChildren()
Empty the list of children items. |
void |
setCommand(MenuBar.Command command)
Set the command for this item. |
void |
setIcon(Resource icon)
Sets the icon. |
protected void |
setParent(MenuBar.MenuItem parent)
Set the parent of this item. |
void |
setText(String text)
Set the text of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MenuBar.MenuItem(String caption, Resource icon, MenuBar.Command command)
text
- The text associated with the commandcommand
- The command to be fired
IllegalArgumentException
Method Detail |
---|
public boolean hasChildren()
public MenuBar.MenuItem addItem(String caption, MenuBar.Command command)
caption
- the text for the menu itemcommand
- the command for the menu itempublic MenuBar.MenuItem addItem(String caption, Resource icon, MenuBar.Command command)
caption
- the text for the menu itemicon
- the icon for the menu itemcommand
- the command for the menu itempublic MenuBar.MenuItem addItemBefore(String caption, Resource icon, MenuBar.Command command, MenuBar.MenuItem itemToAddBefore)
caption
- the text for the menu itemicon
- the icon for the menu itemcommand
- the command for the menu itemitemToAddBefore
- the item that will be after the new itempublic MenuBar.Command getCommand()
public Resource getIcon()
public MenuBar.MenuItem getParent()
MenuBar.MenuItem
, or null if there is nonepublic List<MenuBar.MenuItem> getChildren()
public String getText()
public int getSize()
public int getId()
public void setCommand(MenuBar.Command command)
command
- The MenuCommand of this itempublic void setIcon(Resource icon)
icon
- The icon for this itempublic void setText(String text)
text
- Text for this objectpublic void removeChild(MenuBar.MenuItem item)
item
- The item to be removedpublic void removeChildren()
protected void setParent(MenuBar.MenuItem parent)
parent
- The parent item
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |