Sun Microsystems Computer Accessories User manual

Category
Software manuals
Type
User manual
Sun Microsystems, Inc.
4159 Network Circle
Santa Clara, CA 95054
U.S.A. 650-960-1300
Basic Customization Guide
Wireless Toolkit, Version 2.1
Java
TM
2 Platform, Micro Edition
December 2003
Please
Copyright © 2003 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.
Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this
document. In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed
at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other
countries.
U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license
agreement and applicable provisions of the FAR and its supplements.
Sun, Sun Microsystems, the Sun logo, Java, Solaris, Sun[tm] ONE Studio, Java 2 Platform, Micro Edition, Wireless Toolkit, J2SE, JDK,
and the Java Coffee Cup logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd.
The Adobe® logo is a registered trademark of Adobe Systems, Incorporated.
Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject
to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end
users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities
identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is
strictly prohibited.
DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE
LEGALLY INVALID.
Copyright © 2003 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, Etats-Unis. Tous droits réservés.
Sun Microsystems, Inc. a les droits de propriété intellectuels relatants à la technologie incorporée dans le produit qui est décrit dans
ce document. En particulier, et sans la limitation, ces droits de propriété intellectuels peuvent inclure un ou plus des brevets
américains énumérés à http://www.sun.com/patents et un ou les brevets plus supplémentaires ou les applications de brevet
en attente dans les Etats - Unis et dans les autres pays.
Sun, Sun Microsystems, le logo Sun, Java, Solaris, Sun[tm] ONE Studio, Java 2 Platform, Micro Edition, Wireless Toolkit, J2SE, JDK et
le logo Java Coffee Cup sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. aux Etats-Unis et dans
d’autres pays.
UNIX est une marque déposée aux Etats-Unis et dans d’autres pays et licenciée exlusivement par X/Open Company, Ltd.
Le logo Adobe® est une marque déposée de Adobe Systems, Incorporated.
Les produits qui font l’objet de ce manuel d’entretien et les informations qu’il contient sont régis par la législation américaine en
matière de contrôle des exportations et peuvent être soumis au droit d’autres pays dans le domaine des exportations et importations.
Les utilisations finales, ou utilisateurs finaux, pour des armes nucléaires, des missiles, des armes biologiques et chimiques ou du
nucléaire maritime, directement ou indirectement, sont strictement interdites. Les exportations ou réexportations vers des pays sous
embargo des États-Unis, ou vers des entités figurant sur les listes d’exclusion d’exportation américaines, y compris, mais de manière
non exclusive, la liste de personnes qui font objet d’un ordre de ne pas participer, d’une façon directe ou indirecte, aux exportations
des produits ou des services qui sont régi par la législation américaine en matière de contrôle des exportations et la liste de
ressortissants spécifiquement désignés, sont rigoureusement interdites.
LA DOCUMENTATION EST FOURNIE "EN L’ÉTAT" ET TOUTES AUTRES CONDITIONS, DECLARATIONS ET GARANTIES
EXPRESSES OU TACITES SONT FORMELLEMENT EXCLUES, DANS LA MESURE AUTORISEE PAR LA LOI APPLICABLE, Y
COMPRIS NOTAMMENT TOUTE GARANTIE IMPLICITE RELATIVE A LA QUALITE MARCHANDE, A L’APTITUDE A UNE
UTILISATION PARTICULIERE OU A L’ABSENCE DE CONTREFAÇON.
Contents iii
Contents
Preface xi
1. Customizing the Wireless Toolkit 1
How to Customize the Wireless Toolkit 1
Customization Steps 2
Device Property Files and the Default Emulator 2
2. Creating Device Property Files 5
Make a Copy of an Existing Main Device Property File 5
Obtain and Enter Image Files 6
Obtain and Enter the Screen Properties 7
Screen Location 7
Total Screen Size 8
Display Area 8
Display Area in Full Screen Mode 9
Obtain and Enter the Button Properties 10
Obtain and Enter Soft Button Label Areas 12
Obtain and Enter Icon Properties 14
Defining the Icon Location and States 14
Enter Color Properties 16
Screen Background RGB Color 16
Run the Emulator for the New Device 16
iv Wireless Toolkit Basic Customization Guide December 2003
3. Examining Device Property Files 17
Device Property Files 18
Main Device Property File 19
Fonts 19
Fonts Used by the MIDP APIs 19
Default Font 20
System Fonts 20
Bitmap Fonts 20
Font Underlining 22
The Device Image 22
Image without Buttons Pressed 23
Image with Buttons Pressed 23
Image with Buttons Highlighted and Backlight On 23
Scaling 23
Screen Properties 24
Screen Location 25
Total Screen Size 26
Display Area 26
Display Area in Full Screen Mode 26
Screen Pixel Ratio 27
Screen Background Color 27
Screen Border Color 28
Touch Screen 28
Screen Buffering 28
Device Buttons 29
Keyboard Handler 29
Defining a Device Button 29
Assigning a PC Keyboard Key to a Button 31
Assigning a Game Action to a Button 32
Specifying the Characters Generated by a Button Press 32
Contents v
Assigning Abstract Commands to Buttons 33
Displayed Icons 38
Defining the Icon Location and States 38
Soft Button Label Display 39
Color 40
Sound Alerts 40
Device Software Capabilities 41
Locales 42
Character Encodings 42
Transparent Images 43
A. Default Emulator Device
Property Files 45
Property Files 45
DefaultGrayPhone.properties 46
Device Image Files 53
Icon Image Files 53
B. Support for ByteCode Obfuscators 55
Adding a ByteCode Obfuscator 55
Example 56
C. Connecting to the Wireless Toolkit’s
WMA Emulation Environment 59
Index 61
vi Wireless Toolkit Basic Customization Guide December 2003
vii
Figures
FIGURE 1 Specifying Screen Properties 9
FIGURE 2 Specifying a Button Location 11
FIGURE 3 Soft Button Label Areas on the Emulated Device Display 13
FIGURE 4 Specifying Emulator Fonts 21
FIGURE 5 Specifying Screen Properties 25
FIGURE 6 Specifying a Button Location 31
FIGURE 7 Soft Button Labels on the Emulated Device Display 39
FIGURE 8 Images of Device Key Press States 53
viii Wireless Toolkit Basic Customization Guide December 2003
ix
Tables
TABLE 1 Example of Device Property Files and DefaultGrayPhone Property File 18
TABLE 2 Button Names Available 29
TABLE 3 Abstract Command Types in Order of Precedence 33
TABLE 4 Alert Type Values 41
TABLE 5 Example of Device Property Files 45
TABLE 6 Icon Image Files 53
x Wireless Toolkit Basic Customization Guide December 2003
xi
Preface
The Java
2 Platform, Micro Edition, Wireless Toolkit Basic Customization Guide
describes how to customize the J2ME
Wireless Toolkit by modifying device
property files.
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,
xii Wireless Toolkit Basic Customization Guide December 2003
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.
Preface xiii
Typographic Conventions
Shell Prompts
Related Documentation
Typeface Meaning Examples
AaBbCc123 The names of commands, files,
and directories; on-screen
computer output
Edit your .login file.
Use ls -a to list all files.
% You have mail.
AaBbCc123 What you type, when
contrasted with on-screen
computer output
% su
Password:
AaBbCc123 Book titles, new words or terms,
words to be emphasized
Command-line variable; replace
with a real name or value
Read Chapter 6 in the Users Guide.
These are called class options.
You must be superuser to do this.
To delete a file, type rm filename.
Shell Prompt
C shell machine_name%
Microsoft Windows <directory>
Application Title
J2ME Wireless Toolkit J2ME Wireless Toolkit User’s Guide
J2ME Wireless Toolkit J2ME Wireless Toolkit Release Notes
MIDP - JSR 37 Mobile Information Device Profile for the J2ME
Platform
MIDP - JSR 118 Mobile Information Device Profile 2.0
xiv Wireless Toolkit Basic Customization Guide December 2003
Accessing Sun Documentation Online
The Java Developer Connection
SM
web 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:
CLDC - JSR 30, JSR 139 J2ME Connected Limited Device Configuration
WMA - JSR 120 Wireless Messaging API (WMA) for Java
2
Micro Edition
MMAPI - JSR 135 Mobile Media API
JTWI - JSR 185 Java Technology for the Wireless Industry
J2ME Web Services JSR 172 J2ME
Web Services Specification
Application Title
1
CHAPTER
1
Customizing the Wireless Toolkit
The Java
TM
2 Platform, Micro Edition Wireless Toolkit (J2ME
TM
Wireless 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.
2 Wireless Toolkit Basic Customization Guide December 2003
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
.
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
X
containing a
Main Device Property file named X.properties.
Chapter 1 Customizing the Wireless Toolkit 3
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.
4 Wireless Toolkit Basic Customization Guide December 2003
5
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.
6 Wireless Toolkit Basic Customization Guide December 2003
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:
wtklib\devices\NewPhone\ph1_neut.png
wtklib\devices\NewPhone\ph1_press.png
wtklib\devices\NewPhone\ph1_highlight.png
wtklib\devices\NewPhone\indicator.png
3. Change the image file names in the following lines in NewPhone.properties,
if they are different from the names already present.
default_image = ph1_neut.png
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50
  • Page 51 51
  • Page 52 52
  • Page 53 53
  • Page 54 54
  • Page 55 55
  • Page 56 56
  • Page 57 57
  • Page 58 58
  • Page 59 59
  • Page 60 60
  • Page 61 61
  • Page 62 62
  • Page 63 63
  • Page 64 64
  • Page 65 65
  • Page 66 66
  • Page 67 67
  • Page 68 68
  • Page 69 69
  • Page 70 70
  • Page 71 71
  • Page 72 72
  • Page 73 73
  • Page 74 74
  • Page 75 75
  • Page 76 76
  • Page 77 77
  • Page 78 78

Sun Microsystems Computer Accessories User manual

Category
Software manuals
Type
User manual

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI