Skip Headers
Oracle® Java Micro Edition Software Development Kit Developer's Guide
Release 3.0.5 for Windows
  Go To Table Of Contents
Go To Index


33 JSR 258: Mobile User Interface Customization API

JSR 258 ( defines a standardized Java ME API for querying and manipulating themes and skins on a device. It also defines a file format for describing theme and skin data.

As specified in the JSR, you can define the theme (the appearance) in an XML file with local references to resource files (images, sounds and more) or it can be a JAR file that contains the XML file, its resources, and a properly defined manifest file.

You can use named colors or color values expressed in ARGB format.

33.1 Running the Customization Sample Project

This MIDlet is a color converter that can be viewed using one of three appearances. The converter accepts a hexadecimal, decimal, or octal color specification and converts it to RGB format.

Follow these steps to run the demo:

  1. Select a theme from the radio button list and press the Demo soft key.

  2. Choose a system and enter a value in that format in the Enter Color field. The Alpha value is optional.

    From the soft menu, choose option2, Process. The color converter displays the RGB value.

33.2 Revising Sample Project Appearances

Appearances are associated with the device, in this case, the emulator. To see the XML files for this sample, go to the working directory for the current emulator. For example, see:

C:\Documents and Settings\user\javame-sdk\3.0.5\work\device-#\appdb\customization

The demo allows you to override these sample themes.

  1. Make a copy of a theme file and store it in a different directory.

    The sample expects the file names theme_green.xml and theme_red.xml. When a theme is revised it is overwritten in the emulator's working directory, so your edited copy must reside elsewhere.

  2. Experiment with changing color values, fonts, or other settings, and save your changes. As mentioned earlier, color values must specified in ARGB format, or you can use an SVG 1.1 color keyword.

  3. Run the demo, and in the emulator, choose Device > Customization. The external events generator opens with the Customization tab selected.

  4. In the Appearances area, select the theme you have edited and press the Deinstall button. This does not delete the theme, it merely unloads it from this session.

  5. Press the Install button and browse to select your edited theme. Installing overwrites the theme in the emulator's working directory.

  6. Close the emulator.

  7. Run the Customization project, and choose the revised theme. Verify that your changes are visible.

  8. To restore the original themes, run the project and in the emulator, choose Device > Customization. Press Reset. This overwrites the current themes with the project's original themes.