Package net.sourceforge.jiu.gui.awt
Class AwtMenuWrapper
java.lang.Object
net.sourceforge.jiu.apps.MenuWrapper
net.sourceforge.jiu.gui.awt.AwtMenuWrapper
A wrapper around an AWT MenuBar object.
- Since:
- 0.8.0
- Author:
- Marco Schmidt
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAwtMenuWrapper
(Strings strings, ActionListener actionListener) Internally creates a MenuBar object and provides methods to update that menu bar. -
Method Summary
Modifier and TypeMethodDescriptionprivate Menu
createMenu
(Strings strings, int stringIndex) private MenuShortcut
createMenuShortcut
(int menuIndex) int
Attempts to find one of the menu items in the internal list.Returns the encapsulated MenuBar object.private void
Initializes an object of type MenuBar.void
setEnabled
(int index, boolean enabled) Changes the enabled status of one of the MenuItem objects, given by its index.void
Changes the label text of one of the MenuItem objects, given by its index.void
Changes the enabled status of all MenuItem objects using the argument OperationProcessor object (more precisely, its isAvailable(int) method).void
updateLabels
(Strings strings) Sets the label text of all MenuItem objects to new values using the argument Strings information.Methods inherited from class net.sourceforge.jiu.apps.MenuWrapper
getStringIndex
-
Field Details
-
listener
-
items
-
-
Constructor Details
-
AwtMenuWrapper
Internally creates a MenuBar object and provides methods to update that menu bar.- Parameters:
strings
- String resource used to initialize menu itemsactionListener
- a listener which will be registered with all menu items
-
-
Method Details
-
createMenu
-
createMenuShortcut
-
findIndex
Attempts to find one of the menu items in the internal list. Returns its index or -1 if it is not one of the items.- Specified by:
findIndex
in classMenuWrapper
- Parameters:
o
- some object representing part of the menu- Returns:
- corresponding index value from
MenuIndexConstants
on success or -1 on failure
-
getMenuBar
Returns the encapsulated MenuBar object. -
init
Initializes an object of type MenuBar. -
setEnabled
public void setEnabled(int index, boolean enabled) Changes the enabled status of one of the MenuItem objects, given by its index.- Specified by:
setEnabled
in classMenuWrapper
- Parameters:
index
- menu index of the component whose status is to be resetenabled
- boolean with the new value
-
setLabel
Changes the label text of one of the MenuItem objects, given by its index.- Specified by:
setLabel
in classMenuWrapper
- Parameters:
index
- integer index of the menu elementtext
- new text value to be used for this element
-
updateEnabled
Changes the enabled status of all MenuItem objects using the argument OperationProcessor object (more precisely, its isAvailable(int) method). -
updateLabels
Sets the label text of all MenuItem objects to new values using the argument Strings information.
-