Sun Microsystems Computer Accessories Скачать руководство пользователя страница 1

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

Содержание Computer Accessories

Страница 1: ...Sun Microsystems Inc 4159 Network Circle Santa Clara CA 95054 U S A 650 960 1300 Basic Customization Guide Wireless Toolkit Version 2 1 JavaTM 2 Platform Micro Edition December 2003 ...

Страница 2: ...tats 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...

Страница 3: ...ain 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 Co...

Страница 4: ...age 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...

Страница 5: ... 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 ...

Страница 6: ...vi Wireless Toolkit Basic Customization Guide December 2003 ...

Страница 7: ...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 ...

Страница 8: ...viii Wireless Toolkit Basic Customization Guide December 2003 ...

Страница 9: ...perty 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 ...

Страница 10: ...x Wireless Toolkit Basic Customization Guide December 2003 ...

Страница 11: ...ment 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 devic...

Страница 12: ... 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...

Страница 13: ...s new words or terms words to be emphasized Command line variable replace with a real name or value Read Chapter 6 in the User s 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 Wir...

Страница 14: ...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 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 Servi...

Страница 15: ...ice 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...

Страница 16: ... 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...

Страница 17: ...nstalled 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 ...

Страница 18: ...4 Wireless Toolkit Basic Customization Guide December 2003 ...

Страница 19: ...efaultColorPhone 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 Ent...

Страница 20: ...ons 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...

Страница 21: ... For example netindicator image indicator png netindicator bounds 17 82 19 19 Obtain and Enter the Screen Properties 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 S...

Страница 22: ... 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 a...

Страница 23: ...ll screen area The Default Emulator defines the coordinates for a full screen as follows Upper left coordinate the upper left coordinate of the display area screenPaintableRegion x screenPaintableRegion y x y height width Display Area Full Dimension Name screenPaintableRegion dimension Screen Location Full Dimension Name screen dimension x y height width full screen height ...

Страница 24: ...FT1 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 ...

Страница 25: ...n Location 2 Enter the following measured values for the button properties in NewPhone properties button 0 66 417 41 22 button 1 21 319 41 22 button 2 66 320 41 22 button 3 110 320 41 22 button 4 20 352 41 22 button 5 65 352 41 22 button 6 112 352 41 22 Y height X width Y ...

Страница 26: ...on SOFT1 29 228 33 20 button SOFT2 112 227 32 20 button POWER 33 52 18 10 Obtain and Enter Soft Button Label Areas 1 By measuring the image file obtain the soft button properties NewPhone has two soft buttons similar to the DefaultColorPhone Their label areas are displayed in the area of the screen that is available to icons This area is not directly accessible to the application FIGURE 3 on page ...

Страница 27: ...ixels relative to the left edge of the screen area y The y coordinate of the top edge of the label area in pixels relative to the top edge of the screen area width The width of the label in pixels height The height of the label in pixels font The font of the soft button label align The alignment of the text of the soft button label within its area left right or center 2 Enter the following measure...

Страница 28: ...ther the current MIDlet suite is assigned a trusted domain An icon is defined by A name One of a fixed set of icon names DefaultColorPhone defines the following set of icon names left right up down inmode internet reception and battery A screen location This is a coordinate pair giving the location of the top left corner of the icon in pixels relative to the top left corner of the screen area of t...

Страница 29: ...blank Image files can be in GIF PNG or JPEG format 2 Enter the following measured values for the icons properties in NewPhone properties icon up 44 112 off icon up off icon up on up gif icon down 44 118 off icon down off icon down on down gif icon left 36 114 off icon left off icon left on left gif icon right 52 114 off icon right off icon right on right gif icon internet 64 1 off icon internet of...

Страница 30: ...grayscale screen the background color of the screen can be set The color is defined as a hexadecimal integer according to the standard Java color map That is the integer has the form RRGGBB where RR GG and BB are the red green and blue components of the color respectively For example white would be 0xffffff and red would be 0xff0000 The background color is defined with the property screenBGColor E...

Страница 31: ...bed above to fit with the behavior of the real device The folder wtklib devices in the binary release of the J2ME Wireless Toolkit contains the device property files The syntax of device property files is that of the standard Java 2 Standard Edition property resources For a description of the syntax see the method detail for the load method for the Properties class at the following website http ja...

Страница 32: ... wtklib devices DefaultGrayPhone in the binary installation The shared device property files are located at j2mewtk dir wtklib devices Share in the binary installation See Appendix A Default Emulator Device Property Files for a full example of device property files TABLE 1 Example of Device Property Files and DefaultGrayPhone Property File Property File Description DefaultGrayPhone DefaultGrayPhon...

Страница 33: ...behavior as well as pointers to associated property files The Main Device Property file contains definitions for the following items Each is discussed in detail in the sections below Fonts The Device Image Screen Properties Device Buttons Displayed Icons Soft Button Label Display Color Sound Alerts Device Software Capabilities Fonts There are two types of fonts available for displaying text on the...

Страница 34: ... The default font is specified as follows font default font_properties_filename system font definition Example font default Arial plain 12 System Fonts A system font definition is in the standard Java format for specifying such a font For details see http java sun com j2se 1 4 docs api java awt Font html You can tell the Emulator to use the resident PC fonts to display text on the device screen Us...

Страница 35: ...scent the part of the character that is above the base line descent the part of a character that is below the base line leading the spacing between lines For a complete description of height ascent descent and leading as they relate to fonts see http java sun com j2se 1 4 docs api java awt FontMetrics html The bitmap font property file contains a list of properties of the form ascii_x n horizontal...

Страница 36: ...le to specify the thickness of the line used for underlining by a line of the form font face style size underline width width in pixels The default width of the line is one pixel for plain and italic font styles and two pixels for the bold font style It is also possible to specify the distance of the line used for underlining from the font baseline by a line of the form font face style size underl...

Страница 37: ...ult_image image_filename For example default_image phone_base png Image with Buttons Pressed To specify a device image with the buttons pressed enter a line of the form pressed_buttons_image image_filename For example pressed_buttons_image phone_pressed png Image with Buttons Highlighted and Backlight On To specify a device image with the buttons highlighted and backlighting on enter a line of the...

Страница 38: ...rties In this section you specify the properties of the image of the device screen You need to specify the following screen properties Screen Location Total Screen Size Display Area optional Screen Pixel Ratio optional Screen Background Color optional Touch Screen optional ...

Страница 39: ...age in FIGURE 5 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 x y height x y height width width Display Area Full Dimension Name screenPaintableRegion dimension Screen Location Full Dimension Name screen dimension full screen height ...

Страница 40: ...ainder 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 d...

Страница 41: ...erefore you should only use pixel ratios that preserve the square for example x y 2 2 or 3 3 that is magnifying the image and you should not use pixel ratios that distort the square for example x y 1 2 or 2 1 The ratios are defined as follows screenPixelRatio x horizontal_image_pixels horizontal_device_pixels screenPixelRatio y vertical_image_pixels vertical_device_pixels For most devices use the ...

Страница 42: ... setting touch_screen true causes the device to respond to mouse activity on its screen The default value is touch_screen false Note You only see the effect of the touch_screen property in MIDlets that are specifically written for touch screens such as the PushPuzzle demonstration game included with the J2ME Wireless Toolkit The user interface widgets in the Default Emulator do not respond to touc...

Страница 43: ...e class QwertyKeyboardHandler You specify the keyboard handler by the keyboard handler property which gives the name of the class to be used For example keyboard handler com sun kvem midp DefaultKeyboardHandler Defining a Device Button A button on the emulated device is defined in the main device property file by name and screen location in one of the following forms button button_name x y width h...

Страница 44: ... form can consist of multiple points defined by x and y coordinates A minimum of three sets of x and y coordinates are required to use this form For example if the LEFT button were polygonal it could have the following values button LEFT 166 420 143 432 143 406 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...

Страница 45: ...ou can assign a key on the PC keyboard to a device button in order to simulate a button press by pressing the key instead of clicking on the button with the mouse You use a line of the form key button_name virtual key code height X width Y x1 y1 x2 y2 x3 y3 x4 y4 x5 y5 x6 y6 x7 y7 Rectangular Button Form Polygon Button Form ...

Страница 46: ... 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 genera...

Страница 47: ...specific device The semantics of an abstract command include Label the command name for display purposes Type the category of the command for example BACK or HELP The command type is used to help determine how a command is mapped onto a device Priority a priority number The command priority is used to help determine how a command is mapped onto a device In the MIDP Reference Implementation which u...

Страница 48: ...ands or it can have none of these and just present all abstract commands to the user in an on screen menu The J2ME Wireless Toolkit includes examples of different configurations see the Wireless Toolkit User s Guide Note The mapping policy for abstract commands can vary across actual devices For example command type precedence may differ Emulating Abstract Command Button Assignments The Emulator p...

Страница 49: ...re assigned to the buttons that are defined for them Then the abstract commands are assigned Abstract command precedence is taken into account before abstract command priority Thus if a command of type BACK with priority 2 and a command of type EXIT with priority 1 are competing for a button the BACK command will get the assignment due to its higher precedence Command priority is taken into accoun...

Страница 50: ...y definition where the names are separated by spaces command keys type button_name button_name button_name Example The first definition below assigns commands of type BACK to the END key and alternatively to the SOFT1 key The second definition assigns commands of type OK to the SEND key and alternatively to the SOFT2 key command keys BACK END SOFT1 command keys OK SEND SOFT2 Restricting the List o...

Страница 51: ... defined using the following properties command menu select menu_select_key command menu up menu_up_key command menu down menu_down_key The default values for these properties are command menu select SELECT command menu up UP command menu down DOWN Example This example sets the menu to be activated by the SOFT2 key and to be navigated with the standard keys command menu activate SOFT2 Customizing ...

Страница 52: ...te A mapping of state names to image files An icon can have any number of named states as long as it has a line in the property file for each state giving the image associated with that state If no image file is given for a particular state then no image is displayed when the icon is in that state Defining the Icon Location and States The screen location and initial state of the icon is defined by...

Страница 53: ...0 gif Soft Button Label Display On devices with soft buttons soft button labels are displayed in the area of the screen that is available to icons This area is not directly accessible to the application FIGURE 7 shows the soft button labels Undo and Menu on the lower part of the device screen FIGURE 7 Soft Button Labels on the Emulated Device Display A soft button label display is defined by a lin...

Страница 54: ...tButton left softbutton 1 60 110 36 18 softButton right Color Three 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 available when isColor is true or the number of shades of gray available when isColor is false The gamma property determines the lev...

Страница 55: ...Hz Linear A law and mu law encoded data in any of the supported audio file formats Device Software Capabilities The Default Emulator in the J2ME Wireless Toolkit enables you to define device emulations with additional capabilities that are not required by the MIDP specification Specifically You can specify a default locale You can specify what character encodings are available in the device emulat...

Страница 56: ...es are the lower case two letter codes as defined by ISO 639 You can find a full list of these codes at a number of sites such as http www ics uci edu pub ietf http related iso639 txt The second part is a valid ISO Country Code These codes are the upper case two letter codes as defined by ISO 3166 You can find a full list of these codes at a number of sites such as http www chemie fu berlin de div...

Страница 57: ...ition blank as in microedition encoding supported Note The encoding ISO 8859 1 is always available to applications running on emulated devices whether or not it is listed in the microedition encoding supported entry Transparent Images The Default Emulator supports the alpha channel in the image data by default To disable the alpha channel in the image data change the value of the enableAlphaChanne...

Страница 58: ...44 Wireless Toolkit Basic Customization Guide December 2003 ...

Страница 59: ...es Share ph1_highlight png Device image with buttons highlighted j2mewtk dir wtklib devices Share 123 gif Icon used on device screen j2mewtk dir wtklib devices Share ABC gif Icon used on device screen j2mewtk dir wtklib devices Share abc_lower gif Icon used on device screen j2mewtk dir wtklib devices Share batt gif Icon used on device screen j2mewtk dir wtklib devices Share down gif Icon used on d...

Страница 60: ...aintableRegion x 0 screenPaintableRegion y 11 screenPaintableRegion width 180 screenPaintableRegion height 178 pixel size ratio shape of each pixel example 1x1 square pixel 1x2 rectangular pixel j2mewtk dir wtklib devices Share reception gif Icon used on device screen j2mewtk dir wtklib devices Share right gif Icon used on device screen j2mewtk dir wtklib devices Share secure gif Icon used on devi...

Страница 61: ...lor 0xb6b6aa Transparency support SRC_OVER alpha composition rule supported by deafult enableAlphaChannel true netindicator image Share indicator png netindicator bounds 17 82 19 19 button 0 98 578 47 35 button 1 33 459 45 35 button 2 98 464 47 30 button 3 166 459 45 35 button 4 36 498 45 35 button 5 98 503 47 30 button 6 162 498 45 35 button 7 43 537 47 35 button 8 98 542 47 30 button 9 154 537 4...

Страница 62: ...EL STOP command menu activate SOFT2 keyboard handler com sun kvem midp DefaultKeyboardHandler key 0 VK_0 VK_NUMPAD0 key 1 VK_1 VK_NUMPAD1 key 2 VK_2 VK_NUMPAD2 key 3 VK_3 VK_NUMPAD3 key 4 VK_4 VK_NUMPAD4 key 5 VK_5 VK_NUMPAD5 key 6 VK_6 VK_NUMPAD6 key 7 VK_7 VK_NUMPAD7 key 8 VK_8 VK_NUMPAD8 key 9 VK_9 VK_NUMPAD9 key POUND VK_SUBTRACT key ASTERISK VK_MULTIPLY key POWER VK_ESCAPE key UP VK_UP key DO...

Страница 63: ...nsSerif bold 9 font system bold medium SansSerif bold 11 font system bold large SansSerif bold 14 font system italic small SansSerif italic 9 font system italic medium SansSerif italic 11 font system italic large SansSerif italic 14 font system bold italic small SansSerif bolditalic 9 font system bold italic medium SansSerif bolditalic 11 font system bold italic large SansSerif bolditalic 14 font ...

Страница 64: ...nt proportional italic small SansSerif italic 9 font proportional italic medium SansSerif italic 11 font proportional italic large SansSerif italic 14 font proportional bold italic small SansSerif bolditalic 9 font proportional bold italic medium SansSerif bolditalic 11 font proportional bold italic large SansSerif bolditalic 14 Font underlining Font underlining is enabled by default It is possibl...

Страница 65: ...f icon inmode off icon inmode ABC Share ABC gif icon inmode abc Share abc_lower gif icon inmode 123 Share 123 gif icon inmode kana Share kana gif icon inmode hira Share hira gif icon inmode sym Share sym gif icon domain 149 0 off icon domain off icon domain trusted Share trusted png Sound support alert alert_type sound sound_file Where possible alert_type are alarm info warning error confirmation ...

Страница 66: ...n area softbutton 0 1 192 78 16 softButton left softbutton 1 99 192 78 16 softButton right Gamma value for gamma correction Default value is 1 which means that no gamma correction is actually performed gamma 2 Color Grayscale screen support colorCount 0x100 isColor false These are the labels for the menu softbutton and the menu screen in the device They are here so the phones can be localized indi...

Страница 67: ... 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_highlight png ...

Страница 68: ...t Basic Customization Guide December 2003 internet gif reception gif right gif left gif sym gif kana gif hira gif ABC gif abc_lower gif 123 gif secure gif unsecure gif trusted gif TABLE 6 Icon Image Files Filename Image ...

Страница 69: ...e plug in for it This appendix describes the implementation procedure Adding a ByteCode Obfuscator To plug in a bytecode obfuscator of your choice into the Wireless Toolkit s packaging process you must follow these steps 1 Write your own Java class that implements the com sun kvem environment Obfuscator interface The class file for this interface is located in the j2mewtk dir wtklib kenv zip file ...

Страница 70: ...rs as a method of input to determine which classes and methods are not to be obfuscated The second method is called when the Wireless Toolkit attempts to execute the obfuscator 2 You must add the following properties to the ktools properties file located in j2mewtk dir wtklib Windows obfuscator runner class name The fully qualified name of the class implementing the obfuscator interface This prope...

Страница 71: ... Obfuscators 57 You can get the proguard jar file by downloading the zip file from http proguard sourceforge net and extracting the jar file The proguard jar file must be placed in the Wireless Toolkit s bin directory j2mewtk dir bin ...

Страница 72: ...58 Wireless Toolkit Basic Customization Guide December 2003 ...

Страница 73: ...environment in the Wireless Toolkit to or from J2SE programs outside the Wireless Toolkit environment This enables you to communicate through WMA messages between MIDlets within the Wireless Toolkit emulators and an external J2SE program This external program can provide whatever functionality you program it to have for example imitating a service that responds to WMA messages Create a component t...

Страница 74: ...60 Wireless Toolkit Basic Customization Guide December 2003 ...

Страница 75: ... 35 assigning abstract commands 33 assigning command keys 35 assigning game actions 32 assigning keys 31 assigning menu operations 34 assignment policies 34 changing soft button labels 37 command precedence 33 defining 29 keyboard handler types 29 order of preference 35 specifying alternate buttons 35 specifying generated characters 32 specifying secondary buttons 36 device image files 22 table of...

Страница 76: ...55 proguard jar 57 R RetroGuard byte code obfuscator 55 S screen icons 38 definition 38 setting initial state of 38 setting location 38 screen properties 24 background color 27 buffering 28 defining display area 8 display area 26 full screen display area 27 location 25 pixel size ratio 27 setting location 7 setting screen size 8 size 26 touch screen 28 screenBGColor property 27 screenDoubleBuffer ...

Страница 77: ...Index 63 device property files 1 WMA messages customizing 59 ...

Страница 78: ...64 Wireless Toolkit Basic Customization Guide December 2003 ...

Отзывы: