    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class jclass.contrib.JCMenu

    java.lang.Object
       |
       +----jclass.contrib.JCMenu

public class JCMenu
extends Object

JCMenu is a container for utilities associated with building menus.

##

JCMenu()

##

create(MenuContainer, String[])
  Creates a menu based on the label information provided by the items parameter.
findSubMenu(Menu, String)
  Returns a submenu with a particular title.

##

JCMenu

      public JCMenu()

##

create

      public static Menu create(MenuContainer mb,
                                String items[])

  Creates a menu based on the label information provided by the items parameter. The first string is the title of the menu itself. If the string is prepended with an underscore "_", it is a submenu that is defined later. If the string is of zero length, a separator is added to the menu.

  Here is an example of how it is used:

      public String[] fileMI =   {"File", "Open", "Save", "Save As...",
      "_Import", "Print...", "", "Exit"};
      public String[] importMI = {"From File", "From URL"};
      Menu mb = new MenuBar();
      Menu fileMenu = JCMenu.create(mb, fileMenuItems);
      Menu importMenu = JCMenu.create(JCMenu.findSubMenu(fileMenu, importMI[0]),
      importMI);

  Note that the technique for creating a submenu involves the findSubMenu() member.

  Parameters:
    mb - the parent Menu or MenuBar
    items[] - the array of strings that define the menu item labels
  Returns:
    the Menu containing specified menu items

findSubMenu

      public static Menu findSubMenu(Menu m,
                                     String l)

  Returns a submenu with a particular title.

  Parameters:
    m - the menu that is searched for the specified item
    l - the title of the menu of interest
  Returns:
    the menu matching the query, or null if none is found

    All Packages  Class Hierarchy  This Package  Previous  Next  Index