| java.lang.Object javax.microedition.lcdui.KeyConverter
KeyConverter | class KeyConverter (Code) | | Utility class that is used to convert key codes from platform independent
codes to platform-specific and vice versa.
|
Method Summary | |
native public static int | getGameAction(int keyCode) Returns the game action associated with the given key code on
the device. | native public static int | getKeyCode(int gameAction) Return the key code that corresponds to the specified game
action on the device. | native public static String | getKeyName(int keyCode) Gets an informative key string for a key. | native public static int | getSystemKey(int keyCode) Returns 0 if keyCode is not a system key. |
getGameAction | native public static int getGameAction(int keyCode)(Code) | | 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.
Parameters: keyCode - the key code the corresponding game action (UP, DOWN, LEFT, RIGHT, FIRE, etc.) |
getKeyCode | native public static int getKeyCode(int gameAction)(Code) | | 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.
Parameters: gameAction - The game action to obtain the key code for. the key code. |
getKeyName | native public static String getKeyName(int keyCode)(Code) | | 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))
Parameters: keyCode - the key code being requested a string name for the key, or null if no name is available
|
getSystemKey | native public static int getSystemKey(int keyCode)(Code) | | Returns 0 if keyCode is not a system key.
Otherwise, returns one of the EventConstants.SYSTEM_KEY_ constants.
Parameters: keyCode - get the system equivalent key. translated system key or zero if it is not a system key. |
|
|