Device Buttons
This section describes how to define a button on an emulated device and also describes the assignments associated with the buttons including:
■Assigning a keyboard key press to a button press
■Assigning a game key to a button press
■Specifying the character generated by a button press
■Assigning an abstract command to a button press
Keyboard Handler
The set of names available for device buttons depends on the keyboard handler being used.
There are two
■
■A QWERTY keypad handler (the class QwertyKeyboardHandler)
You specify the keyboard handler by the keyboard.handler property, which gives the name of the class to be used.
For example:
keyboard.handler = com.sun.kvem.midp.DefaultKeyboardHandler
Defining a Device Button
A button on the emulated device is defined in the main device property file by name and screen location in one of the following forms:
button.<button_name> = x, y, width, height
button.<button_name> = x1, y1, x2, y2, x3, y3,...
For the first form (rectangular), the parameters are as follows:
■button_name: The set of button names available is determined by the keyboard handler in use, as shown in TABLE 2.
TABLE 2 | Button Names Available |
|
|
| |
Keyboard Handler | Button Names | |
|
| |
com.sun.kvem.midp.DefaultKeyboardHandler | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, POUND, | |
|
| ASTERISK, POWER, SEND, END, |
LEFT, RIGHT, UP, DOWN,
SELECT, SOFT1, SOFT2, SOFT3,
SOFT4, CLEAR, USER1 through
USER10
Chapter 3 Examining Device Property Files 29