FileDocCategorySizeDatePackage
MenuBarParser.javaAPI DocExample1526Sat Jan 24 10:44:34 GMT 2004je3.gui

MenuBarParser

public class MenuBarParser extends Object implements ResourceParser
Parse a JMenuBar from a ResourceBundle. A menubar is represented simply as a list of menu property names. E.g.: menubar: menu.file menu.edit menu.view menu.help

Fields Summary
static final Class[]
supportedTypes
Constructors Summary
Methods Summary
public java.lang.Class[]getResourceTypes()

        return supportedTypes; 
public java.lang.Objectparse(GUIResourceBundle bundle, java.lang.String key, java.lang.Class type)

	// Get the value of the key as a list of strings
	List menuList = bundle.getStringList(key);

	// Create a MenuBar
	JMenuBar menubar = new JMenuBar();

	// Create a JMenu for each of the menu property names, 
	// and add it to the bar
	int nummenus = menuList.size();
	for(int i = 0; i < nummenus; i++) {
	    menubar.add((JMenu) bundle.getResource((String)menuList.get(i),
						   JMenu.class));
	}
	
	return menubar;