|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--monrovia.client.ui.CommandMenu
This class handles the command menu functionality. It returns the menu command actions of the user and shows the correct commands depending the current game situation. The menu consists of direction buttons, command buttons and a scrollbar which can be used to scroll the command buttons. The direction buttons are always visible and the visibility of other buttons depend on the game situation. Before the commands can be displayed, they must be initialized with command ID and button text. Command class is used to store the commands and making the buttons.
Constructor Summary | |
CommandMenu(int pX,
int pY,
int pW,
int pH)
Constructor for the class. |
Method Summary | |
void |
addCommand(Command pCommand)
Add a new command to the menu. |
void |
clear()
Deletes all the commands from the command list. |
void |
handleKeyDown(int pKeyCode)
The user pressed a key. |
MenuCommand |
handlePenDown(int pX,
int pY)
Indicates the the pen has gone down at (x, y). |
void |
handlePenMove(int pX,
int pY)
The pen has moved at (x, y). |
void |
refresh(boolean pForce)
Clear and repaint the menu. |
void |
removeCommand(int pCommandID)
Remove a command from the menu. |
void |
setScrollValue(int pValue)
Set the current scroll value and repaint. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CommandMenu(int pX, int pY, int pW, int pH)
pX
- X coordinate for the upper left corner of the menu.pY
- Y coordinate for the upper left corner of the menu.pW
- Width of the menu.pH
- Height of the menu.Method Detail |
public void setScrollValue(int pValue)
setScrollValue
in interface com.sun.kjava.ScrollOwner
pValue
- the new scroll valuepublic void addCommand(Command pCommand)
pCommand
- The command object to be added to the menu.public void removeCommand(int pCommandID)
pCommandID
- The ID of the command to be removed from the menu.public void refresh(boolean pForce)
pForce
- true if we want to paint even if nothing was changed,
false otherwisepublic void clear()
public MenuCommand handlePenDown(int pX, int pY)
pX
- the X coordinate of the pen positionpY
- the Y coordinate of the pen positionpublic void handlePenMove(int pX, int pY)
pX
- the X coordinate of the pen positionpY
- the Y coordinate of the pen positionpublic void handleKeyDown(int pKeyCode)
pKeyCode
- a code representing the key the user pressed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |