Java Reference
In-Depth Information
Table 10-2. AGUI-Supported Input Constraints and Values
Constraint
Numeric Value Passed to
Description
putClientProperty
ANY
0
The user is allowed to enter any text.
EMAILADDR
1
The user is allowed to enter an e-mail address.
NUMERIC
2
The user is allowed to enter an integer value.
PHONENUMBER
3
The user is allowed to enter a phone number.
URL
4
The user is allowed to enter a URL.
DECIMAL
5
The user is allowed to enter a signed decimal value.
Because the AGUI may be implemented on devices with specific hardware keys—
such as a remote control or physical buttons on a PDA or smartphone—the AGUI defines
the javax.microedition.agui.event.DeviceKeyEvent that specifies a hardware key event
such as a keypad volume control, dedicated application launch facility, or media control
such as rewind or fast forward. Key event listeners may receive key events (instances of
subclasses of the java.awt.event.KeyEvent class) with the value VK_UNDEFINED , and then
test the event using instanceof to determine if the KeyEvent is really a DeviceKeyEvent . If it
is, you can then determine which hardware key the user pressed by invoking the
DeviceKeyEvent 's getDeviceKeyCode method.
Finally, many consumer electronics devices support soft keys that an application can
assign a custom label and action. The AGUI lets you define these using the interface to
JMenuBar , specifying a menu type and a menu priority . The menu type indicates the
intent of the action your application offers through the soft key, and the menu priority
indicates the importance of this command label relative to other command labels on
the same screen.
Understanding Changes to the Drawing Algorithm
A key compromise of the AGUI is to support the Swing APIs regardless of whether they're
implemented as lightweight components or heavyweight components. To meet this goal,
platform vendors may make a number of changes to better support the native rendering
pipelines found on many of the platforms that implement the AGUI.
Perhaps most noticeable is that the rendering of JComponent subclasses is double-
buffered by default. You can determine whether double buffering is active by calling the
isDoubleBuffered method of any JComponent implementor. You can also request a compo-
nent to perform single buffer drawing by calling setDoubleBuffered and passing false , but
the AGUI implementation can choose to ignore your request.
The underlying UI toolkits on many consumer devices are considerably less flexible
than that found supporting today's Java SE implementations. To meet these restrictions,
 
Search WWH ::




Custom Search