beautypg.com

Assigning a game action to a button – Sun Microsystems Computer Accessories User Manual

Page 46

background image

32

Wireless Toolkit Basic Customization Guide • December 2003

Note –

Virtual key codes are defined by the Abstract Window Toolkit in Java 2

Standard Edition. The definitions are found in the class

java.awt.event.KeyEvent

at

http://java.sun.com/j2se/1.4/docs/api/java/awt/event/

KeyEvent.html

For example,

key.LEFT = VK_LEFT

More than one PC key may be assigned to a single button, using the form:

key.<

button_name

> =

where the virtual key codes are separated by spaces.

For example,

key.0 = VK_0 VK_NUMPAD0

Assigning a Game Action to a Button

The QwertyKeyboardHandler also allows the MIDP game actions to be mapped to
device buttons. You use a line of the form:

game.<

function

> = <

button_name

>

where function can be one of LEFT, RIGHT, UP, DOWN and SELECT and
button_name is the name of a button as shown in

TABLE 2 on page 29

.

The default settings are:

game.UP = UP

game.DOWN = DOWN

game.LEFT = LEFT

game.RIGHT = RIGHT

game.SELECT = SELECT

Specifying the Characters Generated by a Button Press

When using the

QwertyKeyboardHandler

, you can also specify the character

generated by a button press either alone or in combination with the Shift or Alt
buttons.

You use a line of the form:

keyboard.handler.qwerty.<

button_name

> = '' '

character>' ''

where

base character

is the character the button normally generates,

shift

character

is the character used when the button is pressed at the same time as

Shift, and

alternate character

is the character generated when the button is

pressed at the same time as Alt.