Sun Microsystems,Inc. hasintellectual property rightsrelating totechnology embodiedin theproduct that is described in this
document. Inparticular,and withoutlimitation, theseintellectual property rightsmay includeone ormore ofthe U.S.patents listed
at http://www.sun.com/patentsand oneor moreadditional patentsor pendingpatent applicationsin theU.S. andin other
countries.
U.S. GovernmentRights -Commercial software. Governmentusers aresubject tothe SunMicrosystems, Inc. standardlicense
agreement andapplicable provisions ofthe FAR and its supplements.
Sun, SunMicrosystems, theSun logo,Java, Solaris,Sun[tm] ONEStudio, Java2 Platform,Micro Edition, Wireless Toolkit,J2SE, JDK,
and theJava CoffeeCup logoare trademarks or registered trademarksof SunMicrosystems, Inc. in the U.S. and other countries.
UNIX isa registered trademarkin theU.S. andother countries,exclusively licensedthrough X/OpenCompany, Ltd.
The Adobe®logo isa registered trademarkof AdobeSystems, Incorporated.
Products covered byand informationcontained inthis servicemanual are controlled byU.S. ExportControl lawsand may be subject
to theexport orimport lawsin othercountries. Nuclear, missile, chemical biological weapons or nuclear maritime enduses or end
users, whetherdirect orindirect, are strictlyprohibited. Exportor reexport tocountries subjectto U.S.embargo orto entities
identified onU.S. exportexclusion lists,including, butnot limitedto, thedenied personsand speciallydesignated nationalslists is
strictly prohibited.
DOCUMENTATIONIS PROVIDED"AS IS"AND ALLEXPRESS ORIMPLIED CONDITIONS,REPRESENTATIONSAND
WARRANTIES, INCLUDINGANY IMPLIEDWARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULARPURPOSE
OR NON-INFRINGEMENT,ARE DISCLAIMED,EXCEPT TOTHE EXTENTTHATSUCH DISCLAIMERSARE HELD TO BE
LEGALLY INVALID.
Sun Microsystems,Inc. ales droits depropriété intellectuelsrelatants à la technologie incorporée dans le produit quiest décritdans
ce document.En particulier, et sans la limitation, ces droitsde propriétéintellectuels peuventinclure un ou plus des brevets
américains énumérésà http://www.sun.com/patentset unou lesbrevets plussupplémentaires ou les applications de brevet
en attentedans lesEtats -Unis etdans lesautres pays.
Le logoAdobe® estune marquedéposée deAdobe Systems,Incorporated.
Les produitsqui fontl’objet dece manueld’entretien et les informations qu’il contient sont régis par la législation américaine en
matière decontrôle desexportations etpeuvent être soumisau droitd’autres paysdans le domaine des exportations et importations.
Les utilisationsfinales, ouutilisateurs finaux,pour desarmes nucléaires,des missiles,des armesbiologiques etchimiques oudu
nucléaire maritime,directement ou indirectement,sont strictementinterdites. Lesexportations ouréexportations versdes payssous
embargo desÉtats-Unis, ouvers desentités figurantsur leslistes d’exclusiond’exportation américaines,y compris,mais demanière
non exclusive, la liste depersonnes quifont objetd’un ordre dene pasparticiper,d’une façondirecte ou indirecte,aux exportations
des produitsou desservices quisont régipar lalégislation américaineen matière decontrôle desexportations etla listede
ressortissants spécifiquementdésignés, sontrigoureusement interdites.
LA DOCUMENTATION ESTFOURNIE "ENL’ÉTAT" ET TOUTESAUTRES CONDITIONS,DECLARATIONSET GARANTIES
EXPRESSES OUTACITESSONT FORMELLEMENTEXCLUES, DANSLA MESUREAUTORISEE PARLA LOIAPPLICABLE, Y
COMPRIS NOTAMMENT TOUTE GARANTIEIMPLICITE RELATIVE A LA QUALITE MARCHANDE, A L’APTITUDE AUNE
UTILISATIONPARTICULIEREOU AL’ABSENCEDE CONTREFAÇON.
Please
Contents
Prefacexi
1.Customizing the Wireless Toolkit1
How to Customize the Wireless Toolkit1
Customization Steps2
Device Property Files and the Default Emulator2
2.Creating Device Property Files5
Make a Copy of an Existing Main Device Property File5
Obtain and Enter Image Files6
Obtain and Enter the Screen Properties7
Screen Location7
Total Screen Size8
Display Area8
Display Area in Full Screen Mode9
Obtain and Enter the Button Properties10
Obtain and Enter Soft Button Label Areas12
Obtain and Enter Icon Properties14
Defining the Icon Location and States14
Enter Color Properties16
Screen Background RGB Color16
Run the Emulator for the New Device16
Contentsiii
3.Examining Device Property Files17
Device Property Files18
Main Device Property File19
Fonts19
Fonts Used by the MIDP APIs19
Default Font20
System Fonts20
Bitmap Fonts20
Font Underlining22
The Device Image22
Image without Buttons Pressed23
Image with Buttons Pressed23
Image with Buttons Highlighted and Backlight On23
Scaling23
Screen Properties24
Screen Location25
Total Screen Size26
Display Area26
Display Area in Full Screen Mode26
Screen Pixel Ratio27
Screen Background Color27
Screen Border Color28
Touch Screen28
Screen Buffering28
Device Buttons29
Keyboard Handler29
Defining a Device Button29
Assigning a PC Keyboard Key to a Button31
Assigning a Game Action to a Button32
Specifying the Characters Generated by a Button Press32
ivWireless Toolkit Basic Customization Guide • December 2003
Assigning Abstract Commands to Buttons33
Displayed Icons38
Defining the Icon Location and States38
Soft Button Label Display39
Color40
Sound Alerts40
Device Software Capabilities41
Locales42
Character Encodings42
Transparent Images43
A.Default Emulator Device
Property Files45
Property Files45
DefaultGrayPhone.properties46
Device Image Files53
Icon Image Files53
B.Support for ByteCode Obfuscators55
Adding a ByteCode Obfuscator55
Example56
C.Connecting to the Wireless Toolkit’s
WMA Emulation Environment59
Index61
Contentsv
viWireless Toolkit Basic Customization Guide • December 2003
Figures
FIGURE 1Specifying Screen Properties9
FIGURE 2Specifying a Button Location11
FIGURE 3Soft Button Label Areas on the Emulated Device Display13
FIGURE 4Specifying Emulator Fonts21
FIGURE 5Specifying Screen Properties25
FIGURE 6Specifying a Button Location31
FIGURE 7Soft Button Labels on the Emulated Device Display39
FIGURE 8Images of Device Key Press States53
vii
viiiWireless Toolkit Basic Customization Guide • December 2003
Tables
TABLE 1Example of Device Property Files and DefaultGrayPhone Property File 18
TABLE 2Button Names Available 29
TABLE 3Abstract Command Types in Order of Precedence 33
TABLE 4Alert Type Values 41
TABLE 5Example of Device Property Files 45
TABLE 6Icon Image Files 53
ix
xWireless Toolkit Basic Customization Guide • December 2003
Preface
The Java™2 Platform, Micro Edition, Wireless Toolkit Basic Customization Guide
describes how to customize the J2ME
property files.
™
Wireless Toolkit by modifying device
Who Should Use This Book
This guide is intended for developers who need to configure the J2ME Wireless
Toolkit to accommodate device emulators other than the ones provided by the
Wireless Toolkit. This document assumes that you are familiar with Java
programming, Mobile Information Device Profile (MIDP) and the Connected
Limited Device Configuration (CLDC) specifications
.
How This Book Is Organized
This guide contains the following chapters and appendixes:
Chapter 1 describes briefly customization steps, device property files, and the
default emulator.
Chapter 2 explains, through a tutorial, how to create device property files that
enable the Wireless Toolkit to emulate devices other than the default devices
supplied by the toolkit. The tutorial shows you how to obtain and enter image files,
xi
screen properties, button properties, soft button label areas, and icon properties.
The tutorial also explains how to set color properties and how to run the emulator
for the new device.
Chapter 3 describes in depth the components of a device definition and explains
how to create a device definition.
Appendix A lists the property files for the default emulator, describes the
properties for it, and lists the image and icon files for the default emulator.
Appendix B explains how to add a bytecode obfuscator to the Wireless Toolkit
using the framework provided by the toolkit.
Appendix C describes the extension API provided with the Wireless Toolkit that
you can use to connect to the Wireless Toolkit’s WMA emulation environment.
Using Operating System Commands
This document may not contain information on basic UNIX®or Microsoft
Windows commands and procedures such as opening a terminal window,
changing directories, and setting environment variables. See the software
documentation that you received with your system for this information.
xiiWireless Toolkit Basic Customization Guide • December 2003
Typographic Conventions
TypefaceMeaningExamples
AaBbCc123The names of commands, files,
and directories; on-screen
computer output
AaBbCc123What you type, when
contrasted with on-screen
computer output
AaBbCc123Book titles, new words or terms,
words to be emphasized
Edit your .login file.
Use ls -a to list all files.
% You have mail.
% su
Password:
Read Chapter 6 in the User’s Guide.
These are called class options.
Yo u must be superuser to do this.
Command-line variable; replace
with a real name or value
WMA - JSR 120Wireless Messaging API (WMA) for Java
Micro Edition
MMAPI - JSR 135Mobile Media API
JTWI - JSR 185Java Technology for the Wireless Industry
J2ME Web Services JSR 172J2ME
™ Web Services Specification
™ 2
Accessing Sun Documentation Online
The Java Developer ConnectionSMweb site enables you to access Java™platform
technical documentation on the Web.
http://developer.java.sun.com/developer/infodocs/
Sun Welcomes Your Comments
We are interested in improving our documentation and welcome your comments
and suggestions. You can email your comments to us at:
wtk-comments@sun.com
xivWireless Toolkit Basic Customization Guide • December 2003
CHAPTER
1
Customizing the Wireless Toolkit
The JavaTM2 Platform, Micro Edition Wireless Toolkit (J2METMWireless Toolkit)
provides an emulation environment for the development of applications compliant
with the Mobile Information Device Profile (MIDP).
The Java 2 Platform, Micro Edition Wireless Toolkit Basic Customization Guide provides
technical details for configuring the toolkit to accommodate new device emulators.
This chapter gives an overview of customizing the J2ME Wireless Toolkit and
includes the following topics:
■ How to Customize the Wireless Toolkit
■ Device Property Files and the Default Emulator
Chapter 2, “Creating Device Property Files” presents a tutorial on how to adapt the
device definitions in J2ME Wireless Toolkit for a new device.
Chapter 3, “Examining Device Property Files” describes in more detail the
components of a device definition and how to create your own device definition.
How to Customize the Wireless Toolkit
One of the major benefits of the J2ME Wireless Toolkit is its ability to be
customized: it can be readily adapted to provide a platform for developing Java
applications that can run on many different devices, even from different
manufacturers.
To do this, the J2ME Wireless Toolkit provides a Default Emulator that can be easily
customized to provide high-fidelity emulation for many devices. The appearance
and behavior of an emulated device is defined in the Default Emulator by a set of
device property files, which contain the device’s images and property definitions.
Thus, you can add a new device by simply creating a new set of device property
files.
1
Customization Steps
You customize the J2ME Wireless Toolkit for a new device in three simple steps:
1. Obtain the default J2ME Wireless Toolkit.
The toolkit includes a default development environment and a Default Emulator.
The Default Emulator is supplied with sets of device property files that enable the
emulation of several generic wireless devices.
2. Create new device property files.
A company that wants to have applications developed for specific devices using
the toolkit can modify the device property files and use them with the Default
Emulator.
3. Add the new device property files to the J2ME Wireless Toolkit.
The set of device property files that was created for an additional device is copied
to the folder in the J2ME Wireless Toolkit's installation that contains device
definitions. The new device is automatically added to the device list.
Note – If you need to customize the J2ME Wireless Toolkit in a way that cannot be
achieved by producing a new set of device property files alone, please contact Sun
Microsystems, Inc. for information about additional possibilities of customizing the
J2ME Wireless Toolkit. Send email to
wtk-comments@sun.com
.
Device Property Files and the Default
Emulator
The Default Emulator is the customizable device emulator supplied with the J2ME
Wireless Toolkit. It contains the engine used to emulate J2ME applications, along
with a highly configurable front end.
The basic definition of a device to be emulated by the Default Emulator is
contained in its Main Device Property file. The Main Device Property file covers
such features as the size of the screen that is emulated, the locations of image files
used to display the device, and the active areas within these images that are used
to represent buttons. Other device property files are also used to define a device's
characteristics in the Default Emulator; these are mainly image files containing the
device's image and images of any on-screen icons that are used in the device's
emulation.
A device definition's Main Device Property file is located in the wtklib\devices
subdirectory of the J2ME Wireless Toolkit's installation directory. Within the
wtklib\devices directory, each emulated device X has a directory
Main Device Property file named X.properties.
2Wireless Toolkit Basic Customization Guide • December 2003
X
containing a
For example, suppose the J2ME Wireless Toolkit is installed in the directory
C:\WTK21. Then, the Main Device Property File for the device
DefaultColorPhone is located at
C:\WTK21\wtklib\devices\DefaultColorPhone\DefaultColorPhone.pro
perties.
For the remainder of this document, {j2mewtk.dir}, denotes the installation directory
of the J2ME Wireless Toolkit.
Chapter 1Customizing the Wireless Toolkit3
4Wireless Toolkit Basic Customization Guide • December 2003
CHAPTER
2
Creating Device Property Files
This chapter presents a simple tutorial that walks you through the procedures for
creating a device property file. You will learn how to use the new device property
files to enable the J2ME Wireless Toolkit to emulate applications for the device. See
Chapter 3, “Examining Device Property Files” for a detailed reference on device
properties, the custom-tailoring options available, and how to use them.
In the following step-by-step tutorial, you will create a device definition for a
device called NewPhone. Because of the similarity of NewPhone to the
DefaultColorPhone device included with the J2ME Wireless Toolkit, the tutorial
adapts the existing property file for DefaultColorPhone.
The steps of the tutorial are:
■ Make a Copy of an Existing Main Device Property File
■ Obtain and Enter Image Files
■ Obtain and Enter the Screen Properties
■ Obtain and Enter the Button Properties
■ Obtain and Enter Soft Button Label Areas
■ Obtain and Enter Icon Properties
■ Enter Color Properties
■ Run the Emulator for the New Device
Make a Copy of an Existing Main Device
Property File
You will create a device property file for a new emulated device called NewPhone.
The first step in creating a property file for NewPhone is to copy the directory
associated with the existing device, DefaultColorPhone, to the new directory
NewPhone and to rename the main property file.
5
Note – All directory names in this chapter refer to the installation directory of the
J2ME Wireless Toolkit. (If you chose the default option at installation, the directory
is C:\WTK21.)
1. Copy the directory wtklib\devices\DefaultColorPhone and its contents as
wtklib\devices\NewPhone.
2. Rename the main device property file
wtklib\devices\NewPhone\DefaultColorPhone.properties to
wtklib\devices\NewPhone\NewPhone.properties
.
Obtain and Enter Image Files
You need to provide image files for the new device. These image files should differ
only in their representation of the active buttons. (Active buttons are those buttons
used in the emulation of the device in the J2ME Wireless Toolkit.)
The image files are:
■ a default image file showing the active buttons in normal unpressed position
■ an image file showing the active buttons in a pressed position
■ an image file showing the active buttons highlighted and an indicator light to
indicate that backlighting is turned on the device
■ an image of the network indicator icon in the enabled state
These images are used by the Emulator to show visual effects when the user moves
the pointer over, or clicks on, a device button. The device backlight is turned when
a MIDP API is being called or when communication over the network is taking
place. An image file can be in JPEG, GIF, or PNG format.
1. Create the image files such that the size of the device's screen in each image is
the same as the pixel size of the display on the real device.
For example, if the device has a screen of 96 pixels horizontally by 128 vertically,
your images should have the same size as the screen.
2. Insert the new image files in the NewPhone directory in place of the following
files, respectively:
4. Change the indicator image locations in the following lines in
NewPhone.properties, if they are different from the existing locations. The
network indicator location property has the following format:
netindicator.bounds = x, y, width, height
Where x is a horizontal distance in pixels to the network’s indicator left top corner,
y is a vertical distance to the network’s indicator left top corner, width is andindicator’s image width and height is an indicator image’s height. For example:
● By measuring the image file, obtain the screen properties:
■ Screen Location
■ Total Screen Size
■ Display Area
Note – In the following sections, the values entered in the device property file are
assumed to be values that you have measured on the image file and are intended to
be an example.
Screen Location
Referring to the left image in FIGURE 1 on page 9, you specify the location of the
top left corner of the screen relative to the top left corner of the device image by
two lines of the form:
screen.x = <horizontal distance in pixels>
screen.y = <vertical distance in pixels>
● Enter the following measured values for the screen location in
NewPhone.properties:
screen.x = 38
screen.y = 82
Chapter 2Creating Device Property Files7
Total Screen Size
Referring to the left image in FIGURE 1, you specify the total screen size by two
lines of the form:
screen.width = <horizontal distance in pixels>
screen.height = <vertical distance in pixels>
● Enter the following measured values for the total screen size in
NewPhone.properties:
screen.width = 96
screen.height = 128
Display Area
Referring to the right image in FIGURE 1 on page 9, the display area (or paintable
region) is that part of the screen that is available to applications. The remainder of
the screen is for icons and soft button labels.
The coordinates of the display area are relative to the screen location.
You can specify the display area used by the application to be a subregion of the
screen by four lines of the form:
screenPaintableRegion.x = <horizontal distance to display area>
screenPaintableRegion.y = <vertical distance to display area>
screenPaintableRegion.width = <width of display area>
screenPaintableRegion.height = <height of display area>
● Enter the following measured values for the screen display area in
■ Bottom right coordinate - the bottom right coordinate of the screen area:
(screen.x+screen.width, screen.y+screen.height).
Customization of the display area will be available in future versions of the
Wireless Toolkit.
Obtain and Enter the Button Properties
1. By measuring the image file, obtain the button properties.
A button on the emulated device is defined in the main device property file by
name and screen location in the following form:
button.<button_name> = x, y, width, height
where the parameters are as follows:
■ button_name: One of the button names defined for the DefaultColorPhone:0,
1, 2, 3, 4, 5, 6, 7, 8,9, POUND, ASTERISK, SEND, END, LEFT, RIGHT, UP,
DOWN, SELECT, SOFT1, SOFT2 and POWER. For information about how to use
additional button names, see “Device Buttons” on page 29.”
■ x: The x-coordinate of the left edge of the button image, in pixels relative to the
left edge of the device image
■ y: The y-coordinate of the top edge of the button image, in pixels relative to the
top edge of the device image
■ width: The width of the button image, in pixels
■ height: The height of the button image, in pixels.
The button location and dimensions are used for two purposes:
■ To define the active region in which a mouse click is interpreted as a button
press.
■ To define the region of the device image that is used to show graphic effects on
device buttons.
The region for each button should be defined to be large enough to cover the
button's area on all three device images. However, be careful not to allow the
buttons' regions to overlap each other.
The button coordinates are shown in FIGURE 2 on page 11.
10Wireless Toolkit Basic Customization Guide • December 2003
Loading...
+ 54 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.