Displayed Icons

An icon in the context of the Emulator is any graphic, constant or variable, that is displayed on the device screen global region (the region that is outside of the drawable area). This includes scrolling indicators, the battery level indicator and any other images of a similar type.

An icon is defined by:

A name. This name must be known to the Java code that uses the icon. For example, the code to implement scrolling indicators looks for icons named “up” and “down”.

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 the device's image.

A default state. The icon is initially in this state.

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 a line of the form:

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> = <state #n image_filename>

If an icon does not have an image for a particular state, only the name of the icon need be given, and the image field can be left blank.

Image files can be in GIF, PNG, or JPEG format.

For example:

icon.up: 44, 110, off icon.up.off: icon.up.on: up.gif

icon.down: 44, 118, off icon.down.off: icon.down.on: down.gif

icon.internet: 64, 0, off icon.internet.off: icon.internet.on: internet.gif

38 Wireless Toolkit Basic Customization Guide • December 2003

Page 52
Image 52
Sun Microsystems Computer Accessories manual Displayed Icons, Defining the Icon Location and States