|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.ui.MenuItem
Represents an abstract menu item.
Each item has an ordinal specifying the sort order within the menu, and a priority specifying which one should be the default. A lower value indicates a higher priority.
To create menu items in your own application, extend this
abstract class. Your subclasses must implement the
Runnable interface, which in turn supports abstract
dispatching of menu actions on activation. For example
...
// setup the menu items
MenuItem item = new MyMenuItem();
menu.addItem(item);
...
class MyMenuItem {
MyMenuItem() {
super(MyResourceBundle.getBundle(), MyResource.MY_MENU_ITEM, 0, 100);
}
public void run() {
// do something
}
}
| Field Summary | ||
static Comparator |
ORDINAL_COMPARATOR
|
|
| Constructor Summary | ||
MenuItem(ResourceBundle bundle,
int id,
int ordinal,
int priority)
Constructs a new MenuItem. |
||
MenuItem(String text,
int ordinal,
int priority)
Constructs a new MenuItem.
|
||
| Method Summary | ||
int |
getOrdinal()
Retrieves relative ordering of this menu item. |
|
int |
getPriority()
Retrieves relative priority of this menu item. |
|
Field |
getTarget()
Gets the target field for the menu. |
|
boolean |
isSeparator()
Determines if this is a separator. |
|
static MenuItem |
separator(int ordinal)
Adds a separator at the specified position (ordinal) |
|
void |
setText(String text)
Sets the text for the menu item. |
|
String |
toString()
Retrieves text string associated with this menu item. |
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.lang.Runnable |
run |
| Field Detail |
| Constructor Detail |
public MenuItem(ResourceBundle bundle, int id, int ordinal, int priority)
bundle - Resource bundle to support internationalization.id - ID for this menu item (key value for the menu item's associated
string in the resource bundle).ordinal - Ordering parameter, lower values are placed
closer to the top of the menu screen.priority - Priority of the menu item. A lower value indicates a
higher priority, conversely a higher value indicates a lower priority.public MenuItem(String text, int ordinal, int priority)
MenuItem.
text - The text to appear with the MenuItem.ordinal - Ordering parameter, lower values are placed closer to the
top of the menu screen.priority - The priority of the menu item. A lower value indicates a
higher priority, conversely a higher value indicates a lower priority.| Method Detail |
public int getOrdinal()
public int getPriority()
A lower value indicates a higher priority. A higher value indicates a lower value.
public Field getTarget()
ContextMenu.getTarget().public static MenuItem separator(int ordinal)
the - ordinal at which to add the separatorpublic void setText(String text)
This method sets the text string that appears in the menu for this menu item.
String - Text to appear in menu.public String toString()
This method retrieves the text string associated with this menu item. If the menu item object's locale is not the same as the current default locale, this method first sets this menu item's locale to the current default locale, and then returns the appropriate menu string from the resource bundle provided to the menu item at creation time.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.