net.sourceforge.jiu.apps
Class MenuWrapper
java.lang.Object
net.sourceforge.jiu.apps.MenuWrapper
public abstract class MenuWrapper
extends java.lang.Object
Abstract menu wrapper.
A menu consists of a number of menu elements, each of which have a text,
an enabled status and an int constant from MenuIndexConstants associated with it.
abstract int | findIndex(Object o) - Attempts to find the index of a given object that represents a menu element.
|
int | getStringIndex(int menuIndex) - For one of the values in
MenuIndexConstants , returns the corresponding
constant in StringIndexConstants .
|
abstract void | setEnabled(int index, boolean enabled) - Sets the enabled status of one of the menu items to either
true or false .
|
abstract void | setLabel(int index, String text) - Sets the text of one of the menu elements to a new value.
|
findIndex
public abstract int findIndex(Object o)
Attempts to find the index of a given object that represents a menu element.
o
- some object representing part of the menu
getStringIndex
public int getStringIndex(int menuIndex)
menuIndex
- int value from the MenuIndexConstants interface
- int value from the StringIndexConstants interface
setEnabled
public abstract void setEnabled(int index,
boolean enabled)
Sets the enabled status of one of the menu items to either
true
or false
.
index
- menu index of the component whose status is to be resetenabled
- boolean with the new value
setLabel
public abstract void setLabel(int index,
String text)
Sets the text of one of the menu elements to a new value.
This method is usually called when the language settings have changed and
new words have to be assigned.
index
- integer index of the menu elementtext
- new text value to be used for this element