org.mozdev.MacroTracker.toolkit
Class MMenuBuilder

java.lang.Object
  extended by org.mozdev.MacroTracker.toolkit.MMenuBuilder

public class MMenuBuilder
extends java.lang.Object

This class ia a menu builder class that gives you an easy way to create a JMenuBar without a bunch of code.

The methods provide a simple interface to create a menubar, and action listeners are added through the methods to make the menu items do stuff.


Constructor Summary
MMenuBuilder()
           
 
Method Summary
 void addMenu(java.lang.String aName, char aMnemonic)
          Add a menu to the menubar.
 void addMenuItem(java.lang.String aMenu, java.lang.String aName, char aMnemonic)
          Adds a menu item to a menu added.
 void addMenuItem(java.lang.String aMenu, java.lang.String aName, char aMnemonic, java.awt.event.ActionListener aListener)
          Adds a menu item to a menu added.
 void addMenuItem(java.lang.String aMenu, java.lang.String aName, char aMnemonic, java.awt.event.ActionListener aListener, char aAccelerator)
          Adds a menu item to a menu added.
 void addMenuItem(java.lang.String aMenu, java.lang.String aName, char aMnemonic, java.awt.event.ActionListener aListener, java.lang.String aImageURI)
          Adds a menu item to a menu added.
 void addMenuItem(java.lang.String aMenu, java.lang.String aName, char aMnemonic, java.awt.event.ActionListener aListener, java.lang.String aImageURI, char aAccelerator)
          Adds a menu item to a menu added.
 void addSeparator(java.lang.String aMenu)
          Adds a separator to the end of the menu.
 void addSubMenu(java.lang.String aMenu, java.lang.String aName, char aMnemonic)
          Adds a sub menu (basically a menuitem that can have sub-menuitems) to a menu.
 javax.swing.JMenuBar getMenubar()
          Returned the MenuBar generated by the class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MMenuBuilder

public MMenuBuilder()
Method Detail

addMenu

public void addMenu(java.lang.String aName,
                    char aMnemonic)
Add a menu to the menubar.

Parameters:
aName - The name of the menu to add to the menubar.
aMnemonic - The letter the user can hit when the menubar is highlighted to open the menu.

addMenuItem

public void addMenuItem(java.lang.String aMenu,
                        java.lang.String aName,
                        char aMnemonic)
Adds a menu item to a menu added.

Parameters:
aMenu - The name of the menu you want to add this menuitem to (it can be a sub menu or a main menu).
aName - The name of the menu item.
aMnemonic - The letter the user can hit when the menu is opened to start the menus action.

addMenuItem

public void addMenuItem(java.lang.String aMenu,
                        java.lang.String aName,
                        char aMnemonic,
                        java.awt.event.ActionListener aListener)
Adds a menu item to a menu added.

Parameters:
aMenu - The name of the menu you want to add this menuitem to (it can be a sub menu or a main menu).
aName - The name of the menu item.
aMnemonic - The letter the user can hit when the menu is opened to start the menus action.
aListener - The ActionListener to run when the menu item is clicked.

addMenuItem

public void addMenuItem(java.lang.String aMenu,
                        java.lang.String aName,
                        char aMnemonic,
                        java.awt.event.ActionListener aListener,
                        char aAccelerator)
Adds a menu item to a menu added.

Parameters:
aMenu - The name of the menu you want to add this menuitem to (it can be a sub menu or a main menu).
aName - The name of the menu item.
aMnemonic - The letter the user can hit when the menu is opened to start the menus action.
aListener - The ActionListener to run when the menu item is clicked.
aAccelerator - The hot key of this menu item's action.

addMenuItem

public void addMenuItem(java.lang.String aMenu,
                        java.lang.String aName,
                        char aMnemonic,
                        java.awt.event.ActionListener aListener,
                        java.lang.String aImageURI,
                        char aAccelerator)
Adds a menu item to a menu added.

Parameters:
aMenu - The name of the menu you want to add this menuitem to (it can be a sub menu or a main menu).
aName - The name of the menu item.
aMnemonic - The letter the user can hit when the menu is opened to start the menus action.
aListener - The ActionListener to run when the menu item is clicked.
aAccelerator - The hot key of this menu item's action.

addMenuItem

public void addMenuItem(java.lang.String aMenu,
                        java.lang.String aName,
                        char aMnemonic,
                        java.awt.event.ActionListener aListener,
                        java.lang.String aImageURI)
Adds a menu item to a menu added.

Parameters:
aMenu - The name of the menu you want to add this menuitem to (it can be a sub menu or a main menu).
aName - The name of the menu item.
aMnemonic - The letter the user can hit when the menu is opened to start the menus action.
aListener - The ActionListener to run when the menu item is clicked.
aImageURI - The URI of the image to display in the menu item.

addSeparator

public void addSeparator(java.lang.String aMenu)
Adds a separator to the end of the menu.

Parameters:
aMenu - The menu to add the separator to the end to.

addSubMenu

public void addSubMenu(java.lang.String aMenu,
                       java.lang.String aName,
                       char aMnemonic)
Adds a sub menu (basically a menuitem that can have sub-menuitems) to a menu.

You can add items to this new submenu using the addMenuItem() function.

Parameters:
aMenu - The name of the menu you want to add this submenuitem to (it can be a sub menu or a main menu).
aName - The name of the menu item.
aMnemonic - The letter the user can hit when the menu is opened to start the menus action.

getMenubar

public javax.swing.JMenuBar getMenubar()
Returned the MenuBar generated by the class.