Page 2 - Please
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 thisdocument. In particular, and without limitat...
Page 3 - Contents; Preface
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 File...
Page 4 - Examining Device Property Files
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 Butt...
Page 7 - Figures
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...
Page 9 - Tables
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
Page 11 - Who Should Use This Book
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 WirelessToolkit to acco...
Page 12 - Using Operating System Commands
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 emulatorfor the new device. Chapter 3 describes in depth the components of a dev...
Page 13 - Typographic Conventions
Preface xiii Typographic Conventions Shell Prompts Related Documentation Typeface Meaning Examples AaBbCc123 The names of commands, files,and directories; on-screencomputer output Edit your .login file. Use ls -a to list all files. % You have mail . AaBbCc123 What you type, whencontrasted with on-sc...
Page 14 - Accessing Sun Documentation Online; Sun Welcomes Your Comments
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 in...
Page 15 - Customizing the Wireless Toolkit; How to Customize the Wireless Toolkit
1 C H A P T E R 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 compliantwith the Mobile Information Device Profile (MIDP). The Java 2 Platform, Micro Edition Wi...
Page 16 - Customization Steps; Obtain the default J2ME Wireless Toolkit.; Note –
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 Emul...
Page 19 - Creating Device Property Files
5 C H A P T E R 2 Creating Device Property Files This chapter presents a simple tutorial that walks you through the procedures forcreating a device property file. You will learn how to use the new device propertyfiles to enable the J2ME Wireless Toolkit to emulate applications for the device. See Ch...
Page 20 - Obtain and Enter Image Files
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 directoryis C:\WTK21 .) 1. Copy the directory wtklib\devices\DefaultColorPho...
Page 21 - Change the indicator image locations in the following lines in; Obtain and Enter the Screen Properties; By measuring the image file, obtain the screen properties:; Screen Location; Enter the following measured values for the screen location in
Chapter 2 Creating Device Proper ty Files 7 pressed_buttons_image = ph1_press.png highlighted_image = ph1_highlight.png 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 h...
Page 22 - Total Screen Size; Enter the following measured values for the total screen size in; Display Area
8 Wireless Toolkit Basic Customization Guide • December 2003 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 fo...
Page 23 - Display Area in Full Screen Mode
Chapter 2 Creating Device Proper ty Files 9 FIGURE 1 Specifying Screen Properties Display Area in Full Screen Mode The MIDP 2.0 specification allows applications to use the full screen area. TheDefault Emulator defines the coordinates for a full screen as follows: ■ Upper left coordinate - the upper...
Page 24 - Obtain and Enter the Button Properties; By measuring the image file, obtain the button properties.
10 Wireless Toolkit Basic Customization Guide • December 2003 ■ 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 theWireless Toolkit. Obtain a...
Page 26 - By measuring the image file, obtain the soft button properties.
12 Wireless Toolkit Basic Customization Guide • December 2003 button.7 = 21, 384, 41, 22 button.8 = 65, 384, 41, 22 button.9 = 111, 384, 41, 22 button.POUND = 110, 417, 41, 22 button.ASTERISK = 21, 417, 41, 22 button.SEND = 25, 295, 32, 17 button.END = 114, 295, 32, 17 button.LEFT = 37, 254, 26, 26 ...
Page 28 - Obtain and Enter Icon Properties; Defining the Icon Location and States
14 Wireless Toolkit Basic Customization Guide • December 2003 softbutton.0=1,112,40,16, softButton, left softbutton.1=56,112,40,16, softButton, right Obtain and Enter Icon Properties An icon in the context of the Emulator is any graphic, constant or variable, that isdisplayed on the device screen gl...
Page 29 - Enter the following measured values for the icons properties in
Chapter 2 Creating Device Proper ty Files 15 icon.< name > = < x_location >,< y_location >,< initial_state > The icon states are defined by lines of the form: icon.< name >.<state #1> = <state #1 image _ filename > .. icon.< name >.<state #n> = &...
Page 30 - Enter Color Properties; Enter the following measured values for the color properties in; Screen Background RGB Color; Run the Emulator for the New Device
16 Wireless Toolkit Basic Customization Guide • December 2003 Enter Color Properties Two properties are provided to control the color in the Emulator: ■ The isColor property determines whether the display is grayscale (false) or color (true). ■ The colorCount property controls the number of colors a...
Page 32 - Device Property Files
18 Wireless Toolkit Basic Customization Guide • December 2003 Device Property Files The device property files consist of a set of files that define the device’s behaviorand appearance. Each set of device property files is located in a directory whosename determines the name of the device. { j2mewtk....
Page 33 - Main Device Property File; Fonts; Fonts Used by the MIDP APIs
Chapter 3 Examining Device Proper ty Files 19 Main Device Property File This section describes the device property file that the Default Emulator uses toemulate a device. The Main Device Property file is named < device_name > .properties and is located in the directory < device_name > wh...
Page 34 - Default Font; Example; System Fonts; Example; Bitmap Fonts
20 Wireless Toolkit Basic Customization Guide • December 2003 The font definition is according to the format for describing a system font (see “System Fonts” on page 20 ) or a bitmap font (see “Bitmap Fonts” on page 20 ). Example font.system.italic.small: Helvetica-italic-9 The default font (see “De...
Page 36 - Font Underlining; The Device Image
22 Wireless Toolkit Basic Customization Guide • December 2003 .. ascii_x-254 = 1149 ascii_x-255 = 1154 ascii_x-256 = 1160 Note – This type of font supports only eight bit ASCII values (256 characters) and not 16 bit unicode characters. Font Underlining The MIDP specification allows underlined fonts....
Page 37 - Image without Buttons Pressed
Chapter 3 Examining Device Proper ty Files 23 ■ An image with all the active buttons pressed—to show a button being pressedwhen the user selects it ■ An image with all the active buttons highlighted—to provide a visual indicationthat the pointer is sufficiently positioned over a button that a mouse ...
Page 38 - Screen Properties
24 Wireless Toolkit Basic Customization Guide • December 2003 Screen Properties In this section you specify the properties of the image of the device screen. Youneed to specify the following screen properties: ■ Screen Location ■ Total Screen Size ■ Display Area (optional) ■ Screen Pixel Ratio (opti...
Page 41 - Screen Pixel Ratio; Screen Background Color
Chapter 3 Examining Device Proper ty Files 27 Referring to the right image in FIGURE 5 , the full screen display area is defined as the upper left coordinate of the display area, ( screenPaintableRegion. x , screenPaintableRegion . y ), and the bottom right coordinate of the screen area ( screen. x ...
Page 42 - Screen Border Color; Touch Screen; Screen Buffering
28 Wireless Toolkit Basic Customization Guide • December 2003 Screen Border Color You have the option of setting the color of the icon area, the softbutton area (non-paintable areas), and the device menu. Screen background color is used if thisvalue is not defined. The color is defined as a hexadeci...
Page 43 - Device Buttons; Defining a Device Button
Chapter 3 Examining Device Proper ty Files 29 Device Buttons This section describes how to define a button on an emulated device and alsodescribes the assignments associated with the buttons including: ■ Assigning a keyboard key press to a button press ■ Assigning a game key to a button press ■ Spec...
Page 45 - Assigning a PC Keyboard Key to a Button
Chapter 3 Examining Device Proper ty Files 31 FIGURE 6 Specifying a Button Location Assigning a PC Keyboard Key to a Button You can assign a key on the PC keyboard to a device button in order to simulate abutton press by pressing the key (instead of clicking on the button with the mouse). You use a ...
Page 46 - Assigning a Game Action to a Button; Specifying the Characters Generated by a Button Press
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 exam...
Page 47 - Assigning Abstract Commands to Buttons
Chapter 3 Examining Device Proper ty Files 33 There are two ways you can do a button press at the same time as pressing Shift orAlt: ■ Map the buttons to the keyboard, as in the previous section, and press the keyassociated with the button at the same time as the Shift or Alt keys ■ Press the button...
Page 48 - Emulating Abstract Command Button Assignments
34 Wireless Toolkit Basic Customization Guide • December 2003 The MIDP implementation in the Wireless Toolkit allocates a command issued bythe application to a device button based on the following considerations: 1. The first consideration is the natural correspondence between the command’s type and...
Page 49 - Precedence of Assigning Commands to a Button
Chapter 3 Examining Device Proper ty Files 35 2. Use the definition command.keys.< command_type > to assign command types to preferred buttons according to their natural correspondence. See “Assigning an Abstract Command Type to a Button” on page 35 3. Use the secondary button assignments to s...
Page 50 - Secondary Button Assignments
36 Wireless Toolkit Basic Customization Guide • December 2003 command.keys.BACK = SOFT1 command.keys.EXIT = SOFT1 command.keys.CANCEL = SOFT1 command.keys.STOP = SOFT1 command.keys.OK = SOFT2 command.keys.SCREEN = SOFT2 command.keys.ITEM = SOFT2 command.keys.HELP = SOFT2 In cases of conflict in the ...
Page 51 - The Abstract Command Menu
Chapter 3 Examining Device Proper ty Files 37 The Abstract Command Menu When there are more abstract commands specified by an application than there arebuttons to which they can be mapped, the unmapped abstract commands areplaced in a command menu. The following operations are defined for thecommand...
Page 52 - Displayed Icons
38 Wireless Toolkit Basic Customization Guide • December 2003 Displayed Icons An icon in the context of the Emulator is any graphic, constant or variable, that isdisplayed on the device screen global region (the region that is outside of thedrawable area). This includes scrolling indicators, the bat...
Page 53 - Soft Button Label Display
Chapter 3 Examining Device Proper ty Files 39 icon.reception: 0, 0, on icon.reception.on: reception.gif icon.battery: 80, 0, full icon.battery.full: batt_3.gif icon.battery.half: batt_2.gif icon.battery.low: batt_1.gif icon.battery.none: batt_0.gif Soft Button Label Display On devices with soft butt...
Page 54 - Color; Sound Alerts
40 Wireless Toolkit Basic Customization Guide • December 2003 softbutton.< number > = < x >,< y >,< width >,< height >,< font >,< align > where the parameters are defined as follows: ■ The coordinates of the soft button label: ■ x : The x-coordinate of the l...
Page 55 - Device Software Capabilities
Chapter 3 Examining Device Proper ty Files 41 alert.< alert_type >.sound = < sound_file > where the possible values of < alert_type > are as defined by MIDP specification as follows: If no sound file is defined (no alert-specific sound and no default sound) for aparticular alert, t...
Page 56 - Locales; Character Encodings
42 Wireless Toolkit Basic Customization Guide • December 2003 Locales A locale is a geographic or political region or community that shares the samelanguage, customs, or cultural convention. In software, a locale is a collection offiles, data, and code, which contains the information necessary to ad...
Page 57 - Transparent Images
Chapter 3 Examining Device Proper ty Files 43 microedition.encoding: UTF-8 microedition.encoding.supported: UTF-8, UTF-16, ISO-8859-1, ISO-8859-2, Shift_JIS To support all encodings supported by the J2ME platform, leave the microedition.encoding.supported definition blank, as in: microedition.encodi...
Page 59 - Property Files
45 A P P E N D I X A Default Emulator DeviceProperty Files This appendix presents a list of the device property files provided with the DefaultEmulator and information on the Default Emulator properties. Property Files The following property files are used. TABLE 5 Example of Device Property Files P...
Page 60 - DefaultGrayPhone.properties
46 Wireless Toolkit Basic Customization Guide • December 2003 DefaultGrayPhone.properties default_image=..\Share\ph1_neut.png pressed_buttons_image=..\Share\ph1_press.png highlighted_image=..\Share\ph1_highlight.png ## screen properties ## # Screen location, relative to the top-left corner of the # ...
Page 67 - Device Image Files
Appendix A Default Emulator Device Proper ty Files 53 Device Image Files FIGURE 8 Images of Device Key Press States Icon Image Files The following table lists filenames and their associated images: TABLE 6 Icon Image Files Filename Image batt.gif down.gif up.gif ph1_neut.png ph1_press.png ph1_highli...
Page 69 - Support for ByteCode Obfuscators; Write your own Java class that implements the
55 A P P E N D I X B Support for ByteCode Obfuscators The Wireless Toolkit contains a support framework for bytecode obfuscators. It alsoincludes a plug-in for this framework for the ProGuard and Retroguard bytecodeobfuscators. You can use a bytecode obfuscator other than ProGuard orRetroGuard, howe...
Page 70 - You must add the following properties to the
56 Wireless Toolkit Basic Customization Guide • December 2003 ■ run(File jarFileObfuscated, String wtkBinDir, String wtkLibDir, String jarFilename, String projectDir, String classPath, String emptyApi) where jarFileObfuscated is the file that holds the obfuscated JAR wtkBinDir is the directory holdi...
Page 75 - Index
61 Index A abstract command types assigning to a button, 35 abstract commands assigning to buttons, 33menu operations, 37table of, 33 abstract commands, types of, 33 ascii_x- n , 21 B bitmap font definition, 20button assignments, emulating, 34button properties, setting, 10byte code obfuscator, 55 C ...