Package net.sourceforge.jiu.apps
Class MenuWrapper
java.lang.Object
net.sourceforge.jiu.apps.MenuWrapper
- Direct Known Subclasses:
AwtMenuWrapper
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.
- Author:
- Marco Schmidt
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract int
Attempts to find the index of a given object that represents a menu element.int
getStringIndex
(int menuIndex) For one of the values inMenuIndexConstants
, returns the corresponding constant inStringIndexConstants
.abstract void
setEnabled
(int index, boolean enabled) Sets the enabled status of one of the menu items to eithertrue
orfalse
.abstract void
Sets the text of one of the menu elements to a new value.
-
Constructor Details
-
MenuWrapper
public MenuWrapper()
-
-
Method Details
-
findIndex
Attempts to find the index of a given object that represents a menu element.- Parameters:
o
- some object representing part of the menu- Returns:
- corresponding index value from
MenuIndexConstants
on success or -1 on failure
-
getStringIndex
public int getStringIndex(int menuIndex) For one of the values inMenuIndexConstants
, returns the corresponding constant inStringIndexConstants
.- Parameters:
menuIndex
- int value from the MenuIndexConstants interface- Returns:
- 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 eithertrue
orfalse
.- Parameters:
index
- menu index of the component whose status is to be resetenabled
- boolean with the new value
-
setLabel
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.- Parameters:
index
- integer index of the menu elementtext
- new text value to be used for this element
-