public class KeyMainMenu
extends java.lang.Object
implements java.awt.event.ActionListener
| Constructor and Description |
|---|
KeyMainMenu(javax.swing.JMenuBar menuBar,
MainMenuListener menuListener)
Creates an instance with the given values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent ev) |
KeyItem |
addItem(java.lang.String key,
java.lang.String caption)
Creates and returns a new item with the given values and associates it with the given key.
|
void |
addSeparator()
Adds a separator line at the current sub menu.
|
javax.swing.JMenu |
createSubMenu(java.lang.String title)
Creates an item leading to a new sub menu.
|
KeyItem |
getItem(java.lang.String key)
Returns the item which is associated with the given key or null if no such item exists.
|
void |
itemAdded(KeyItem item)
Registers the given item's key and adds an action listener to it.
|
javax.swing.JMenu |
nextSubMenu(java.lang.String title)
Creates an item leading to a new sub menu one sub menu layer above the current layer.
|
void |
popSubMenu()
Sets the current sub menu to the one which is one layer above the current sub menu.
|
public KeyMainMenu(javax.swing.JMenuBar menuBar,
MainMenuListener menuListener)
menuBar - the menu bar into which the items are to be added.menuListener - the listener to add to each added item.public void itemAdded(KeyItem item)
public KeyItem addItem(java.lang.String key, java.lang.String caption)
key - the key of the item to createcaption - the caption of the item to createpublic KeyItem getItem(java.lang.String key)
public javax.swing.JMenu createSubMenu(java.lang.String title)
title - the caption of the item to createpublic javax.swing.JMenu nextSubMenu(java.lang.String title)
title - the caption of the item to createpublic void addSeparator()
public void popSubMenu()
public void actionPerformed(java.awt.event.ActionEvent ev)
actionPerformed in interface java.awt.event.ActionListener