FileDocCategorySizeDatePackage
MainMenuScreen.javaAPI DocWireless Messaging API3718Thu Oct 09 23:10:52 BST 2003wmasample

MainMenuScreen

public class MainMenuScreen extends Object
MainMenuScreen Implements the WMA sample application's main menu.

Fields Summary
public static Command
SELECT
/ /** Select Command
public static Command
EXIT
Exit Command
private Display
display
/ /** Current display context
private CommandListener
commandListener
The command listener responsible of application navigation
private Ticker
ticker
The screen's ticker
private List
screen
The menu screen
private Image[]
menuIcons
List of main menu icons
private String[]
menuItems
List of main menu text items
Constructors Summary
public MainMenuScreen(Display d, CommandListener cl)
Constructor.

param
d is the display context.
param
cl is the command listener for this screen.


                         
         
        display = d;
        commandListener = cl;
        try {
            //  Load Main Meny Icons.
            menuIcons[0] = Image.createImage(UIConstants.IMG_ROOT+UIConstants.EMAIL_IMG);
            menuIcons[1] = Image.createImage(UIConstants.IMG_ROOT+UIConstants.CAL_IMG);
            menuIcons[2] = Image.createImage(UIConstants.IMG_ROOT+UIConstants.CONTACTS_IMG);
        } catch (java.io.IOException ignore) {
            // Ignore...
            System.out.println(UIConstants.MSG_ERROR_LOADING_IMG);
        }
        screen = new List(UIConstants.TXT_MAIN_MENU, List.IMPLICIT, menuItems, menuIcons);
        screen.addCommand(EXIT);
        screen.addCommand(SELECT);
        screen.setCommandListener(commandListener);
        screen.setTicker(ticker);
    
Methods Summary
public intgetMenuSelection()
Returns the main menu selected item.

        return screen.getSelectedIndex();
    
public DisplayablegetScreen()
Returns the main menu Displayable.

        return screen;
    
public voidsetTicker(java.lang.String text)
Sets the content of the display's ticker

        ticker.setString(text);
    
public voidshowMenu()
Make the main menu visible.

        if (display != null) {
            display.setCurrent(screen);
        }