This is with reference to the description of the GameCanvas class at
http://java.sun.com/javame/reference...ameCanvas.html
On this page, the code example given for getKeyStates() method is as follows:
// Get the key state and store it
int keyState = getKeyStates();
if ((keyState & LEFT_KEY) != 0) {
positionX--;
}
else if ((keyState & RIGHT_KEY) != 0) {
positionX++;
}
There are two typos in the above example: LEFT_KEY must be replaced with LEFT_PRESSED, and similarly RIGHT_KEY with RIGHT_PRESSED.

Reply With Quote



