com.nokia.mid.ui
Class VirtualKeyboard

java.lang.Object
  extended bycom.nokia.mid.ui.VirtualKeyboard

public class VirtualKeyboard
extends java.lang.Object

Some touch devices can use a virtual keyboard as a replacement for the physical keyboard and thus allow client to use keypad in Canvas, GameCanvas and CustomItem. Key presses are handled in Canvas' and CustomItems keyPressed method.

VirtualKeyboard is an interface that provides access to CustomKeyboardControl which allows MIDlets to control visibility, type and mode of the CUSTOM_KEYBOARD. VirtualKeyboard also allows MIDlets to register keyboard visibility listener which will notify clients when SYSTEM_KEYBOARD or CUSTOM_KEYBOARD keyboard visibility changes.


Field Summary
static int CUSTOM_KEYBOARD
          Constant for custom keyboard type that is controlled by CustomKeyboardControl.
static int SYSTEM_KEYBOARD
          Constant for system keyboard type that is controlled by the Java platform editors for example TextBox keyboard.
static int VKB_MODE_ALPHA_LOWER_CASE
          Input Mode: ALPHA_LOWER_CASE - Keypad appearance has lower case alphabetic characters.
static int VKB_MODE_ALPHA_UPPER_CASE
          Input Mode: ALPHA_UPPER_CASE - Keypad appearance has upper case alphabetic characters.
static int VKB_MODE_ALPHA_UPPER_CASE_LOCKED
          Input Mode: ALPHA_UPPER_CASE_LOCKED - Keypad appearance has upper case alphabetic characters and shift icon shown as locked.
static int VKB_MODE_DEFAULT
          Input Mode: DEFAULT.
static int VKB_MODE_NUMERIC
          Input Mode: NUMERIC - Keypad appearance has numeric characters only
static int VKB_TYPE_GAME
          Keyboard Type: GAME - not currently supported by Virtual Keyboard component.
static int VKB_TYPE_ITUT
          Keyboard Type: ITUT.
 
Method Summary
static CustomKeyboardControl getCustomKeyboardControl()
          Gets singleton instance of CustomKeyboardControl Custom keyboard control is used for controlling custom virtual keyboard in touch devices that can be used when physical keypad is not available.
static int getHeight()
          Gets the height of visible virtual keyboard.
static int getWidth()
          Gets the width of visible virtual keyboard.
static int getXPosition()
          Gets the x rendering position of visible virtual keyboard.
static int getYPosition()
          Gets the y rendering position of visible virtual keyboard.
static void hideOpenKeypadCommand(boolean hide)
          Called by the MIDlet to disable/enable the state of the default platform open keypad command in Canvas and/or CustomItem menus.
static boolean isVisible()
          Gets current visibility state of the virtual keyboard
static void setVisibilityListener(KeyboardVisibilityListener listener)
          Sets virtual keyboard visibility listener.
static void suppressSizeChanged(boolean suppressSizeChange)
          Suppresses sizeChanged events when virtual keyboard visibility changes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CUSTOM_KEYBOARD

public static final int CUSTOM_KEYBOARD
Constant for custom keyboard type that is controlled by CustomKeyboardControl. This constant is used in KeyboardVisibilityListener to indicate which keyboard type had visibility change

See Also:
Constant Field Values

SYSTEM_KEYBOARD

public static final int SYSTEM_KEYBOARD
Constant for system keyboard type that is controlled by the Java platform editors for example TextBox keyboard. This constant is used in KeyboardVisibilityListener to indicate which keyboard type had visibility change

See Also:
Constant Field Values

VKB_TYPE_ITUT

public static final int VKB_TYPE_ITUT
Keyboard Type: ITUT.

See Also:
Constant Field Values

VKB_TYPE_GAME

public static final int VKB_TYPE_GAME
Keyboard Type: GAME - not currently supported by Virtual Keyboard component.

See Also:
Constant Field Values

VKB_MODE_DEFAULT

public static final int VKB_MODE_DEFAULT
Input Mode: DEFAULT. Keypad appearance will have both numeric and alphabetic characters shown

See Also:
Constant Field Values

VKB_MODE_NUMERIC

public static final int VKB_MODE_NUMERIC
Input Mode: NUMERIC - Keypad appearance has numeric characters only

See Also:
Constant Field Values

VKB_MODE_ALPHA_LOWER_CASE

public static final int VKB_MODE_ALPHA_LOWER_CASE
Input Mode: ALPHA_LOWER_CASE - Keypad appearance has lower case alphabetic characters.

See Also:
Constant Field Values

VKB_MODE_ALPHA_UPPER_CASE

public static final int VKB_MODE_ALPHA_UPPER_CASE
Input Mode: ALPHA_UPPER_CASE - Keypad appearance has upper case alphabetic characters.

See Also:
Constant Field Values

VKB_MODE_ALPHA_UPPER_CASE_LOCKED

public static final int VKB_MODE_ALPHA_UPPER_CASE_LOCKED
Input Mode: ALPHA_UPPER_CASE_LOCKED - Keypad appearance has upper case alphabetic characters and shift icon shown as locked.

See Also:
Constant Field Values
Method Detail

hideOpenKeypadCommand

public static void hideOpenKeypadCommand(boolean hide)
Called by the MIDlet to disable/enable the state of the default platform open keypad command in Canvas and/or CustomItem menus. After setting this to hidden the open keypad command will not appear in any Canvas or CustomItem menu.

Note: By default, in some touch devices, the open keypad command is always added to Canvases and CustomItem instances.

Parameters:
hide - the new visibility state of the open keypad command: true if MIDlet needs this command to be hidden/removed from the menu or false otherwise.

getXPosition

public static int getXPosition()
Gets the x rendering position of visible virtual keyboard. Visible keyboard can be either SYSTEM_KEYBOARD or CUSTOM_KEYBOARD

Returns:
the x-position of the keyboard
Throws:
java.lang.IllegalStateException - if keyboard data cannot be read

getYPosition

public static int getYPosition()
Gets the y rendering position of visible virtual keyboard. Visible keyboard can be either SYSTEM_KEYBOARD or CUSTOM_KEYBOARD

Returns:
the y-position of the keyboard
Throws:
java.lang.IllegalStateException - if keyboard data cannot be read

getWidth

public static int getWidth()
Gets the width of visible virtual keyboard. Keyboard can be either SYSTEM_KEYBOARD or CUSTOM_KEYBOARD

Returns:
the width in pixels of the keyboard
Throws:
java.lang.IllegalStateException - if keyboard data cannot be read

getHeight

public static int getHeight()
Gets the height of visible virtual keyboard. Keyboard can be either SYSTEM_KEYBOARD or CUSTOM_KEYBOARD

Returns:
the height in pixels of the keyboard
Throws:
java.lang.IllegalStateException - if keyboard data cannot be read

setVisibilityListener

public static void setVisibilityListener(KeyboardVisibilityListener listener)
Sets virtual keyboard visibility listener. Visibility listener is called when visibility of the virtual keyboard changes. Virtual keyboard visibility changes are followed for both SYSTEM_KEYBOARD and CUSTOM_KEYBOARD

Throws:
java.lang.IllegalStateException - if visibility listener cannot be set

getCustomKeyboardControl

public static CustomKeyboardControl getCustomKeyboardControl()
Gets singleton instance of CustomKeyboardControl Custom keyboard control is used for controlling custom virtual keyboard in touch devices that can be used when physical keypad is not available. CustomKeyboardControl will only control custom keyboard and does not affect system keyboards.

Returns:
singleton instance of CustomKeyboardControl
Throws:
java.lang.IllegalStateException - if KeyboardControl is not yet instantiated

isVisible

public static boolean isVisible()
Gets current visibility state of the virtual keyboard

Returns:
true if any virtual keyboard is visible
Throws:
java.lang.IllegalStateException - if visibility state cannot be read

suppressSizeChanged

public static void suppressSizeChanged(boolean suppressSizeChange)
Suppresses sizeChanged events when virtual keyboard visibility changes. If sizeChanged is suppressed for virtual keyboard, virtual keyboard visibility changes will not cause sizeChanged(int, int). This setting will affect all system and custom virtual keyboards.

Parameters:
suppressSizeChange - If true, virtual keyboard visibility changes will not cause sizeChanged. If false, virtual keyboard visibility change causes sizeChanged.
Throws:
java.lang.IllegalStateException - if java platform cannot save setting


Copyright © 2012 Nokia Corporation. All rights reserved.

Nokia is registered trademark of Nokia Corporation. Java and all Java-based marks are trademarks or registered trademarks of Oracle Corporation. Other product and company names mentioned herein may be trademarks or trade names of their respective owners. This document is confidential information of Nokia Corporation.

Disclaimer
The information in this document is provided "as is," with no warranties whatsoever, including any warranty of merchantability, fitness for any particular purpose, or any warranty otherwise arising out of any proposal, specification, or sample. Furthermore, information provided in this document is preliminary, and may be changed substantially prior to final release.

Nokia Corporation disclaims all liability, including liability for infringement of any proprietary rights, relating to this document and implementation of any information presented in this document.

Nokia Corporation retains the right to make changes to this document at any time, without notice.

License
Subject to above disclaimer, a license is hereby granted to use this documentation solely under existing Limited License Agreement and non-disclosure agreement between the companies for the agreed application development for Series 40 Nokia phones. No other licenses e.g. to any intellectual property rights are granted herein. Any use of the screen shots of this documentation, including any icons thereof, is subject to Nokia's prior written approval.