net.rim.device.api.ui
Class KeypadUtil

java.lang.Object
  |
  +--net.rim.device.api.ui.KeypadUtil

public class KeypadUtil
extends Object

Provides keypad utility functionality.

Since:
JDE 4.1.0
See Also:
Keypad

Field Summary
static int MODE_EN_LOCALE
          Use this constant to specify that keys conversion should occur according to English locale
static int MODE_UI_CURRENT_LOCALE
          Use this constant to specify that keys conversion should occur according to current UI system locale
 
Method Summary
static char getKeyChar(int keycode, int mode)
          Retrieves character matching specified key from the keymap than corresponds to current system UI locale.
static int getKeyCode(char ch, int status, int mode)
          Performs reverse lookup of key code that corresponds to given char and status.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_EN_LOCALE

public static final int MODE_EN_LOCALE
Use this constant to specify that keys conversion should occur according to English locale
See Also:
getKeyChar(int keycode, int mode), getKeyCode(char ch, int status, int keycode)
Since:
JDE 4.1.0

MODE_UI_CURRENT_LOCALE

public static final int MODE_UI_CURRENT_LOCALE
Use this constant to specify that keys conversion should occur according to current UI system locale
See Also:
getKeyChar(int keycode, int mode), getKeyCode(char ch, int status, int keycode)
Since:
JDE 4.1.0
Method Detail

getKeyChar

public static char getKeyChar(int keycode,
                              int mode)
Retrieves character matching specified key from the keymap than corresponds to current system UI locale. If there more then one character that corresponds to given key than first character is provided.

Invoke this method to retrieve a specific character from keymap associated with current UI locale, given a particular key and status value.

Parameters:
key - Key and Status composition. This kind of composed key code used in Field event loop callback methods. To extract key or status portions use Keypad.key(int keycode) and Keypad.status(int keycode)methods
mode - Identifies type of data used for keys conversion. Can be one of MODE_UI_CURRENT_LOCALE and MODE_EN_LOCALE constants.
Returns:
Character in keymap associated with keycode.
Since:
JDE 4.1.0
See Also:
getKeyCode(char ch, int status, int keycode)

getKeyCode

public static int getKeyCode(char ch,
                             int status,
                             int mode)
Performs reverse lookup of key code that corresponds to given char and status. This can be used in Field.keyChar(char character, int status, int time) event callbacks to obtain original keycode.
Parameters:
ch - Key Char that would be generated with specified conversion data(mode) for resulting keycode
status - Status value for key
mode - Identifies type of data used for keys conversion. Can be one of MODE_UI_CURRENT_LOCALE and MODE_EN_LOCALE constants.
Returns:
Keycode Key and Status composition that corresponds to given char and status
Since:
JDE 4.1.0
See Also:
getKeyChar(int keycode, int mode)



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.