|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectPamView.MenuItemEnabler
public class MenuItemEnabler
Now that there are many menus, there will several instances of each menu item. Each menu item may therefore be added to a MenuItemEnabler which will ensure that all items are enabled / disabled together.
Can also be used to setSelected
Reworked with a static list of all MenuItemEnablers so that when menus are removed from the system (which happens a lot !) they can be easily removed from all the Enablers.
| Field Summary | |
|---|---|
private boolean |
currentEnabled
|
private boolean |
currentSelected
|
private static java.util.Vector<MenuItemEnabler> |
enablerList
|
private java.util.Vector<javax.swing.JMenuItem> |
menuItemList
|
| Constructor Summary | |
|---|---|
MenuItemEnabler()
Default constructor compiles a list of all MenuItemEnablers so that they can be cleaned up on mass |
|
| Method Summary | |
|---|---|
void |
addMenuItem(javax.swing.JMenuItem newItem)
Add a menu item to a menu item enabler. |
void |
enableItems(boolean enable)
Enable all menu items in a MenuItemEnabler list |
boolean |
isEnabled()
Returns the currentEnabled state |
boolean |
isSelected()
Gets the current selected state for this enabler |
private void |
removeAllMenuItems(javax.swing.JMenu menu)
Iterate through the menu and it's menu items and remove every one from the enabler |
static void |
removeMenuBar(javax.swing.JMenuBar menuBar)
Call this for a menu that is no longer needed to remove all it's items from the enabler list. |
void |
removeMenuItem(javax.swing.JMenuItem newItem)
|
void |
selectItems(boolean select)
Select all menu items in a MenuItemEnabler list |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.Vector<javax.swing.JMenuItem> menuItemList
private boolean currentEnabled
private boolean currentSelected
private static java.util.Vector<MenuItemEnabler> enablerList
| Constructor Detail |
|---|
public MenuItemEnabler()
| Method Detail |
|---|
public static void removeMenuBar(javax.swing.JMenuBar menuBar)
menu - menu to be cleaned from menu enablers.private void removeAllMenuItems(javax.swing.JMenu menu)
menu - public void addMenuItem(javax.swing.JMenuItem newItem)
The menu items selected state and enabled state will be set immediately.
newItem - new menu item to manage.public void removeMenuItem(javax.swing.JMenuItem newItem)
public void enableItems(boolean enable)
enable - enable or disablepublic void selectItems(boolean select)
select - select or deselectpublic boolean isEnabled()
public boolean isSelected()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||