KeyConverterpublic class KeyConverter extends Object Utility class that is used to convert key codes from platform independent
codes to platform-specific and vice versa. |
Methods Summary |
---|
public static native int | getGameAction(int keyCode)Returns the game action associated with the given key code on
the device. keyCode must refer to a key that is mapped as a
game key on the device. The game action of the key is returned.
The return value will be 0 if the key is not mapped to
a game action, or it will be -1 if the keycode is invalid.
| public static native int | getKeyCode(int gameAction)Return the key code that corresponds to the specified game
action on the device. gameAction must be a defined game action
(Canvas.UP, Canvas.DOWN, Canvas.FIRE, etc.)
Post-conditions: The key code of the key that
corresponds to the specified action is returned. The return
value will be 0 if the game action is invalid or not supported
by the device.
| public static native java.lang.String | getKeyName(int keyCode)Gets an informative key string for a key. The string returned
should resemble the text physically printed on the key. For
example, on a device with function keys F1 through F4, calling
this method on the keycode for the F1 key will return the
string "F1". A typical use for this string will be to compose
help text such as "Press F1 to proceed."
There is no direct mapping from game actions to key
names. To get the string name for a game action, the
application must call
getKeyName(getKeyCode(GAME_A))
| public static native int | getSystemKey(int keyCode)Returns 0 if keyCode is not a system key.
Otherwise, returns one of the EventConstants.SYSTEM_KEY_ constants.
|
|