|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.ui.vole.Component jcontrol.ui.vole.menu.Menu
public abstract class Menu
The abstract class Menu
is the superclass for
graphical menus.
(c) Copyright 2003-2007 DOMOLOGIC GmbH
Field Summary | |
---|---|
protected java.util.Vector |
m_inactive
|
protected java.util.Vector |
m_items
|
protected int |
m_lastSelectedIndex
|
protected ActionListener |
m_listener
|
protected boolean |
m_repaint
|
protected int |
m_selectedIndex
|
Fields inherited from class jcontrol.ui.vole.Component |
---|
eventQueue, focusOwner, font, g, height, listener, parent, visible, width, x, y |
Constructor Summary | |
---|---|
Menu(int x,
int y,
int width,
int height)
|
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. |
protected boolean |
hasNextOrPrev(boolean updown,
int index)
Checks if the specified menu item has an active predecessor or successor. |
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. |
abstract void |
paint()
Paint has to be implemented by the deviating class. |
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. |
protected int |
selectNextOrPrev(boolean updown)
Selects the next or previous menu item in this menu. |
void |
setActionListener(ActionListener listener)
Set the ActionListener for this menu. |
void |
setFont(Resource font)
Set the font for this component. |
void |
setParent(Container parent)
Sets the parent Container. |
Methods inherited from class jcontrol.ui.vole.Component |
---|
getBounds, getParent, isVisible, onActionEvent, removeFocus, requestFocus, setBounds, setGraphics, setVisible, transferFocus, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, toString, wait |
Methods inherited from interface jcontrol.ui.vole.menu.MenuInterface |
---|
setGraphics |
Field Detail |
---|
protected int m_selectedIndex
protected int m_lastSelectedIndex
protected boolean m_repaint
protected java.util.Vector m_items
protected java.util.Vector m_inactive
protected ActionListener m_listener
Constructor Detail |
---|
public Menu(int x, int y, int width, int height)
Method Detail |
---|
public void setFont(Resource font)
setFont
in class Component
font
- The new font.public int addMenuItem(String item)
addMenuItem
in interface MenuInterface
item
- the name of the menu item, can even specify an image name
public void setParent(Container parent)
setParent
in interface MenuInterface
setParent
in class Component
parent
- the Container to be the parent Objectpublic int addMenuItem(String item, int pos)
addMenuItem
in interface MenuInterface
item
- the name of the menu item, can even specify an image namepos
- the position
public void removeMenuItem(String item)
removeMenuItem
in interface MenuInterface
item
- the item to removepublic int getActiveItemCount()
getActiveItemCount
in interface MenuInterface
public void enableMenuItem(String item, boolean onoff)
enableMenuItem
in interface MenuInterface
item
- the name to the menu itemonoff
- enable or disablepublic boolean isMenuItemEnabled(String item)
isMenuItemEnabled
in interface MenuInterface
item
- the menu item
public int getSelectedIndex()
getSelectedIndex
in interface MenuInterface
public boolean select(int index)
select
in interface MenuInterface
index
- the index of the item to select
public boolean select(String item)
select
in interface MenuInterface
item
- the item to select
protected int selectNextOrPrev(boolean updown)
updown
- if true, select the next item, the previous otherwise
protected boolean hasNextOrPrev(boolean updown, int index)
updown
- if true, check for a successor, for a predecessor otherwiseindex
- the index of the menu item
public abstract void paint()
paint
in interface MenuInterface
paint
in class Component
paint()
public void remove()
remove
in interface MenuInterface
remove
in class Component
public void setActionListener(ActionListener listener)
ActionListener
for this menu. It will
receive action events when a menu item is selected.
listener
- The action listener to associate with this menu.public boolean onKeyEvent(KeyEvent e)
onKeyEvent
in interface MenuInterface
onKeyEvent
in class Component
e
- The KeyEvent.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |