|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.ui.wombat.Component jcontrol.ui.wombat.AbstractFocusComponent jcontrol.ui.wombat.menu.Menu
public abstract class Menu
The abstract class Menu
is the superclass for graphical menus.
(c) Copyright 2005-2007 DOMOLOGIC GmbH
Field Summary | |
---|---|
protected boolean[] |
m_inactives
|
protected Object[] |
m_items
|
protected int |
m_scrollValue
|
protected int |
m_selectedIndex
|
Fields inherited from class jcontrol.ui.wombat.AbstractFocusComponent |
---|
BORDER_WIDTH, listener |
Fields inherited from interface jcontrol.ui.wombat.IFocusable |
---|
TRANSFER_FOCUS_BACKWARD, TRANSFER_FOCUS_FORWARD |
Fields inherited from interface jcontrol.ui.wombat.event.TouchListener |
---|
RESULT_ACCEPTED, RESULT_EXECUTED, RESULT_NONE |
Constructor Summary | |
---|---|
Menu(String[] items,
int x,
int y,
int width,
int height)
|
Method Summary | |
---|---|
abstract int |
addMenuItem(String item)
Adds a menu item to this menu. |
int |
getIndex(String item)
Returns the index of the specified item or -1 if there is no such item
in this menu. |
String |
getItem(int index)
Returns the item at the specified index or null if the index is
out of range. |
int |
getItemCount()
Returns the number of menu items. |
int |
getSelectedIndex()
Returns the index of the selected menu item or -1 if none is selected. |
abstract int |
insertMenuItem(String item,
int index)
Inserts a menu item at the specified position. |
abstract boolean |
removeMenuItem(int index)
Removes a menu at the specified index item from this menu. |
protected boolean |
selectNextOrPrev(boolean updown)
Selects the next or previous menu item in this menu. |
void |
setEnabled(int index,
boolean enabled)
Enables or disables the menu item at the specified index. |
boolean |
setSelection(int index)
Selects the item at the given zero-relative index in the receiver's list. |
Methods inherited from class jcontrol.ui.wombat.AbstractFocusComponent |
---|
clearCorners, drawBevelRect, drawButton, drawDottedRect, drawFocusRect, getActionListener, onActionEvent, onKeyEvent, onTouchEvent, requestFocus, setActionListener, setEnabled, setVisible |
Methods inherited from class jcontrol.ui.wombat.Component |
---|
drawDisabledImage, getFrame, isEnabled, isVisible, isVisibleInternal, paint, redrawInternalAndParent, repaint, repaintAll, safeExec, setBackgroundColor, setBackgroundColorInternal, setBounds, setDirty, setFont, setForegroundColor, setForegroundColorInternal, setParametersInternal, setRedraw, setTransparentColor, unsafeExec, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, toString, wait |
Field Detail |
---|
protected int m_selectedIndex
protected int m_scrollValue
protected Object[] m_items
protected boolean[] m_inactives
Constructor Detail |
---|
public Menu(String[] items, int x, int y, int width, int height)
Method Detail |
---|
public abstract int addMenuItem(String item)
item
- the name of the menu item, can even specify an image name
insertMenuItem(String, int)
public abstract int insertMenuItem(String item, int index)
item
- the name of the menu item, can even specify an image nameindex
- the position
addMenuItem(String)
public abstract boolean removeMenuItem(int index)
setEnabled(int, boolean)
method instead.
index
- the index to remove
true
if the item has been removed successfully,
false
otherwisesetEnabled(int, boolean)
public void setEnabled(int index, boolean enabled)
index
- the index to enable or disableenabled
- the new enabled statepublic int getItemCount()
public int getSelectedIndex()
public String getItem(int index)
null
if the index is
out of range.
index
- the index
public int getIndex(String item)
-1
if there is no such item
in this menu.
item
- the item to search for
public boolean setSelection(int index)
index
- the index of the item to select
true
if the item has been selected successfully,
false
otherwiseprotected boolean selectNextOrPrev(boolean updown)
updown
- if true, select the next item, the previous otherwise
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |