/** * Create a menu with the given menuitem names. * * @param menuItems the names that will appear in the phone's menu * @param listener the commandlistener that will handle the commandevents * @param display the Displayable object were te commands will be added to. */ public static final void makeMenu( String[] menuItems, CommandListener listener, Displayable display) { // create command for every menuitem in the string array for (int i = 0; i < menuItems.length; i++) { Command cmd = new Command(menuItems[i], Command.ITEM, 2); display.addCommand(cmd); } // let the given listener handle the command events display.setCommandListener(listener); }