jcontrol.ui.vole.menu
Interface MenuInterface

All Known Implementing Classes:
BigImageMenu, Menu, MenuBar, MultiImageMenu, TextMenu

public interface MenuInterface

This interface is the main interface used by jcontrol.ui.vole.Menu
. The meaning of this interface is to avoid loading the Menu class into a JControl device even if no menu is used only because the menu is referenced by jcontrol.ui.vole.Frame by default.
By referencing this interface instead of the (abstract) menu class, no unnecessary class will be uploaded.
NOTE: Normally, there is no need to implement this interface in any other class but jcontrol.ui.vole.Menu.

(c) Copyright 2003-2007 DOMOLOGIC GmbH


Method Summary
 int addMenuItem(String item)
          Adds a menu item to this menu.
 int addMenuItem(String item, int pos)
          Adds a menu item to this menu at the specified position.
 void enableMenuItem(String item, boolean onoff)
          Changes the active state of a menu item in this menu.
 int getActiveItemCount()
          Returns the number of active menu items.
 int getSelectedIndex()
          Returns the index of the selected menu item
 boolean isMenuItemEnabled(String item)
          Returns the active state of the specified menu item.
 boolean onKeyEvent(KeyEvent e)
          If a KeyEvent accurs, this method is called.
 void paint()
           
 void remove()
          Removes this menu from the screen.
 void removeMenuItem(String item)
          Removes a menu item from this menu.
 boolean select(int index)
          Selects the specified menu item.
 boolean select(String item)
          Selects the specified menu item
 void setGraphics(Graphics g)
          This method is called to set the main Display context for this component.
 void setParent(Container parent)
          Sets the parent Frame.
 

Method Detail

setParent

void setParent(Container parent)
Sets the parent Frame.

Parameters:
parent - the Frame handle this menu.

setGraphics

void setGraphics(Graphics g)
This method is called to set the main Display context for this component.
Normally, this is done only for the top-level container, then, all child components are set automatically.

Parameters:
g - the grahics context

onKeyEvent

boolean onKeyEvent(KeyEvent e)
If a KeyEvent accurs, this method is called.

Parameters:
e - the KeyEvent.
Returns:
false if the KeyEvent was consumed, true otherwise.

paint

void paint()
See Also:
Menu.paint()

addMenuItem

int addMenuItem(String item)
Adds a menu item to this menu.

Parameters:
item - the name of the menu item, can even specify an image name
Returns:
the index of the new menu item

addMenuItem

int addMenuItem(String item,
                int pos)
Adds a menu item to this menu at the specified position.

Parameters:
item - the name of the menu item, can even specify an image name
pos - the position
Returns:
the index of the new menu item

removeMenuItem

void removeMenuItem(String item)
Removes a menu item from this menu.

Parameters:
item - the item to remove

remove

void remove()
Removes this menu from the screen.


getActiveItemCount

int getActiveItemCount()
Returns the number of active menu items.


enableMenuItem

void enableMenuItem(String item,
                    boolean onoff)
Changes the active state of a menu item in this menu.

Parameters:
item - the name to the menu item
onoff - enable or disable

isMenuItemEnabled

boolean isMenuItemEnabled(String item)
Returns the active state of the specified menu item.

Parameters:
item - the menu item
Returns:
boolean the active state of the menu item

getSelectedIndex

int getSelectedIndex()
Returns the index of the selected menu item


select

boolean select(int index)
Selects the specified menu item.

Parameters:
index - the index of the item to select
Returns:
boolean true if the item has been selected successfully, false otherwise

select

boolean select(String item)
Selects the specified menu item

Parameters:
item - the item to select
Returns:
boolean true if the item has been selected successfully, false otherwise