net.rim.device.api.ui
Class Keypad

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

public final class Keypad
extends Object

Provides keypad functionality.

See Also:
KeypadListener

Field Summary
static long GUID_KEYPAD_CHANGED
          GUID for global event sent when the current locale changes.
static int HW_LAYOUT_32
          QWERTY keyboard layout (87xx series). 38 keys.
static int HW_LAYOUT_LEGACY
          Legacy QWERTY keyboard layout (57xx, 58xx series). 30 keys.
static int HW_LAYOUT_PHONE
          QWERTY /w phone keyboard layout (65xx, 67xx, 72xx, 75xx, 77xx series). 34 keys.
static int HW_LAYOUT_REDUCED
          Reduced QW-ER-TY-OP keyboard layout (71xx series). 23 keys.
static int HW_LAYOUT_REDUCED_24
          Reduced QW-ER-TY-OP keyboard layout (81xx series). 24 keys.
static int KEY_ALT
          ALT key constant.
static int KEY_APPLICATION
          Application key constant.
static int KEY_BACKLIGHT
          Backlight key constant.
static int KEY_BACKSPACE
          Backspace key constant.
static int KEY_CONVENIENCE_1
          Convenience Key 1 constant.
static int KEY_CONVENIENCE_2
          Convenience key 2 constant.
static int KEY_DELETE
          Delete key constant.
static int KEY_END
          End key constant.
static int KEY_ENTER
          Enter key constant.
static int KEY_ESCAPE
          Escape key constant.
static int KEY_MENU
          Menu key constant.
static int KEY_MIDDLE
          Middle key (between SEND and END) constant.
static int KEY_NEXT
          Next key constant.
static int KEY_SEND
          Send key constant.
static int KEY_SHIFT_LEFT
          Left-shift key constant.
static int KEY_SHIFT_RIGHT
          Right-shift key constant.
static int KEY_SHIFT_X
          Right-shift/0 key constant.
static int KEY_SPACE
          Space key constant.
static int KEY_SPEAKERPHONE
          Speakerphone toggle key constant.
static int KEY_VOLUME_DOWN
          Volume down key constant.
static int KEY_VOLUME_UP
          Volume up key constant.
 
Method Summary
static char getAltedChar(char ch)
          Retrieves alternate version of specified character.
static int getHardwareLayout()
          Retrieves system keyboard harware style.
static int getKeyCode(char ch, int status)
          Performs reverse lookup of key code that corresponds to given char and status.
static Locale getLocale()
          Retrieves this keypad's locale.
static char getUnaltedChar(char ch)
          Retrieves the un-alted version of a character.
static boolean hasSendEndKeys()
          Determines if the device has dedicated SEND/END keys.
static boolean isOnKeypad(char ch)
          Determines if a key is on the keypad.
static boolean isValidKeyCode(int keycode)
          Determines if a keycode is valid in this keymap.
static int key(int keycode)
          Retrieves the key portion of the specified keycode.
static int keycode(char scancode, int status)
          Retrieves keycode, given base character and modifier key state.
static char map(int keycode)
          Retrieves character matching keycode from keymap.
static char map(int key, int status)
          Retrieves character matching specified key from the keymap.
static void setMode(int mode)
          Sets the keypad mode, which determines the keypad icons to display.
static int status(int keycode)
          Retrieves state of modifier keys, given keycode.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail


GUID_KEYPAD_CHANGED

public static final long GUID_KEYPAD_CHANGED
GUID for global event sent when the current locale changes.

HW_LAYOUT_PHONE

public static final int HW_LAYOUT_PHONE
QWERTY /w phone keyboard layout (65xx, 67xx, 72xx, 75xx, 77xx series). 34 keys.
Since:
JDE 4.1.0

HW_LAYOUT_REDUCED

public static final int HW_LAYOUT_REDUCED
Reduced QW-ER-TY-OP keyboard layout (71xx series). 23 keys.
Since:
JDE 4.1.0

HW_LAYOUT_REDUCED_24

public static final int HW_LAYOUT_REDUCED_24
Reduced QW-ER-TY-OP keyboard layout (81xx series). 24 keys.
Since:
JDE 4.2.0

HW_LAYOUT_LEGACY

public static final int HW_LAYOUT_LEGACY
Legacy QWERTY keyboard layout (57xx, 58xx series). 30 keys.
Since:
JDE 4.1.0

HW_LAYOUT_32

public static final int HW_LAYOUT_32
QWERTY keyboard layout (87xx series). 38 keys.
Since:
JDE 4.1.0

KEY_BACKLIGHT

public static final int KEY_BACKLIGHT
Backlight key constant.

KEY_BACKSPACE

public static final int KEY_BACKSPACE
Backspace key constant.

KEY_DELETE

public static final int KEY_DELETE
Delete key constant.

KEY_ESCAPE

public static final int KEY_ESCAPE
Escape key constant.

KEY_ENTER

public static final int KEY_ENTER
Enter key constant.

KEY_SPACE

public static final int KEY_SPACE
Space key constant.

KEY_SHIFT_RIGHT

public static final int KEY_SHIFT_RIGHT
Right-shift key constant.

KEY_SHIFT_X

public static final int KEY_SHIFT_X
Right-shift/0 key constant.

KEY_ALT

public static final int KEY_ALT
ALT key constant.

The ALT key has no label -- it is the coloured key just below the A key and to the left of the Z key.


KEY_SHIFT_LEFT

public static final int KEY_SHIFT_LEFT
Left-shift key constant.

KEY_APPLICATION

public static final int KEY_APPLICATION
Application key constant.

KEY_SPEAKERPHONE

public static final int KEY_SPEAKERPHONE
Speakerphone toggle key constant.
Since:
JDE 4.1.0

KEY_SEND

public static final int KEY_SEND
Send key constant.
Since:
JDE 4.0.0

KEY_END

public static final int KEY_END
End key constant.
Since:
JDE 4.0.0

KEY_MIDDLE

public static final int KEY_MIDDLE
Middle key (between SEND and END) constant.
Since:
JDE 4.2.0

KEY_CONVENIENCE_1

public static final int KEY_CONVENIENCE_1
Convenience Key 1 constant.
Since:
JDE 4.2.0

KEY_CONVENIENCE_2

public static final int KEY_CONVENIENCE_2
Convenience key 2 constant.
Since:
JDE 4.2.0

KEY_NEXT

public static final int KEY_NEXT
Next key constant.
Since:
JDE 4.0.0

KEY_VOLUME_UP

public static final int KEY_VOLUME_UP
Volume up key constant.
Since:
JDE 4.2.0

KEY_VOLUME_DOWN

public static final int KEY_VOLUME_DOWN
Volume down key constant.
Since:
JDE 4.2.0

KEY_MENU

public static final int KEY_MENU
Menu key constant.
Since:
JDE 4.2.0
Method Detail

getAltedChar

public static char getAltedChar(char ch)
Retrieves alternate version of specified character.

Invoke this method to retrieve the character produced through pressing the ALT key in combination with your specified character. If the character cannot be alted, then 0 is returned.

For example, these are true on a RIM 5800 device:

   getAltedChar('W') == '2'
   getAltedChar('2') == '\u0000'
 

And, these are true on a RIM 6700 device:

 
   getAltedChar('W') == '1' 
   getAltedChar('1') == '\u0000'
 

Note: to get the alted version of a key, use Keypad.map(Keypad.key(keycode), KeypadListener.STATUS_ALT).

Parameters:
ch - Character for which to derive alternate version.
Returns:
Alternate version of provided character.
See Also:
getUnaltedChar(char)

getLocale

public static Locale getLocale()
Retrieves this keypad's locale.
Returns:
Locale keypad is using.

getUnaltedChar

public static char getUnaltedChar(char ch)
Retrieves the un-alted version of a character.

Invoke this method to retrieve the character produced through not pressing the ALT key in combination with your specified character. If the character cannot be unalted, then 0 is returned.

For example, these are true on a RIM 5800 device:

   getUnaltedChar('W') == '\u0000'
   getUnaltedChar('2') == 'W'
 

And, these are true on a RIM 6700 device:

 
   getUnaltedChar('W') == '\u0000' 
   getUnaltedChar('1') == 'W'
 

Note: to get the alted version of a key, use Keypad.map(Keypad.key(keycode), KeypadListener.STATUS_ALT).

Parameters:
ch - Character for which to derive alternate version.
Returns:
Alternate version of provided character.
Since:
JDE 3.6.0
See Also:
getAltedChar(char)

map

public static char map(int keycode)
Retrieves character matching keycode from keymap.

Invoke this method to retrieve a specific character from this keymap, given its keycode.

Parameters:
keycode - Keycode of key.
Returns:
Character in keymap associated with keycode.

map

public static char map(int key,
                       int status)
Retrieves character matching specified key from the keymap.

Invoke this method to retrieve a specific character from this keymap, given a particular key and status value.

Parameters:
key - The key.
status - Status value for key; this consists of the state of the various modifier keys.
Returns:
Character in keymap associated with the key and modifier keys.

key

public static int key(int keycode)
Retrieves the key portion of the specified keycode.
Parameters:
keycode - Keycode for a key.
Returns:
Key portion of the keycode.

getHardwareLayout

public static int getHardwareLayout()
Retrieves system keyboard harware style.
Returns:
Identifier for system hardware keyboard style, one of the HW_LAYOUT_* constants
Since:
JDE 4.1.0

getKeyCode

public static int getKeyCode(char ch,
                             int status)
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 - Character that would be generated by current input map with resulting keycode and given status
status - Status value for key
Returns:
Keycode Simple key code (no 16 bit shift and composition with status value) that corresponds to given char and status
Since:
JDE 4.2.0
See Also:
map(int key, int status)

status

public static int status(int keycode)
Retrieves state of modifier keys, given keycode.

Invoke this method to retrieve the state modifier keys must be in to produce a particular key code.

Parameters:
keycode - Keycode for which you want to infer the modifier key state.
Returns:
Mask indiciating the state of the modifier keys.

isOnKeypad

public static boolean isOnKeypad(char ch)
Determines if a key is on the keypad.
Parameters:
ch - Character key to verify.
Returns:
True if on this keypad; otherwise, false.
Since:
JDE 3.6.0

isValidKeyCode

public static boolean isValidKeyCode(int keycode)
Determines if a keycode is valid in this keymap.
Parameters:
keycode - Keycode you want to check.
Returns:
True if keycode exists in this keymap; otherwise, false.

keycode

public static int keycode(char scancode,
                          int status)
Retrieves keycode, given base character and modifier key state.

Invoke this method to retrieve a particular keycode, given the base character and state of the modifier keys.

Parameters:
scancode - Base character.
status - State of the modifier keys.
Returns:
Keycode for the key.

hasSendEndKeys

public static boolean hasSendEndKeys()
Determines if the device has dedicated SEND/END keys.
Returns:
True if the device has dedicated SEND/END keys; otherwise, false.
Since:
JDE 4.0.0

setMode

public static void setMode(int mode)
Sets the keypad mode, which determines the keypad icons to display.
Parameters:
mode - One of the KEYPAD_MODE_ values.
Since:
JDE 4.2.0


Copyright 1999-2006 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.