Using this information you will be able to customize MicroEmulator to look and behave like the mobile device for which you do your developement.
There is a good tutorial written by Bertil Gralvik Skinning the MicroEmulator. We are directing you to his website for introduction. Here we will just summarize interfaces for your quick reference.
The Skin of MicroEmulator is described in the device.xml file. There are skins for different devices packaged with product distribution so you can rename the existing skin to start a new one. The Device class for a Skin is optional: you only need to provide xml descriptor and images and package them in jar. We have also created the Another Skin collection, however, its images can only be used with the vendor's special permission.
To use a new device you have to pack it in a JAR Java Archive or Zip file (New). You can have more than one device in one archive. MicroEmulator will find .xml files in the archive and will use them as a device descriptors. MicroEmulator will load images from this archive as resources so you will need to keep the directory structure in this archive. Once installed, a skin archive is copied to $home/.microemulator/ directory, and the references to this archive and devices are recorded in the $home/.microemulator/config2.xml file.
Here is the suggested archive directory structure:
Archive root
|-- org
| `-- microemu
| `-- devices
| `-- vendor
| `-- model
| |-- device.xml
| |-- normal.png
| |-- pressed.pngThe following section describes the mobile device descriptor elements defined in the device.xml file. See Schema for device.xml http://www.microemu.org/2.0.2/device.xsd and XML Schema Documentation.
Buttons key attr defines its function
Buttons name attr defines its function
The root element for device.xml is device. It contains img images making up the skin, display and fonts definition and finally input descriptor.
Allow inheritance for devices. Xml element name plus optional attribute 'name' are unique identifiers for xml descriptor inheritance
Example:
<device xmlns="http://www.microemu.org/2.0.2/" name="Extended minimum device, color, pointer, moto like keys" extends="/org/microemu/device/minimum/device.xml">
<display>
<iscolor>true</iscolor>
<numcolors>65536</numcolors>
</display>
<input>
<haspointerevents>true</haspointerevents>
<softbutton name="SOFT1" keyCode="-21"/>
<softbutton name="SOFT2" keyCode="-22"/>
</input>
</device>System properties. Ignored while running in the applet.
<system-properties>
<system-property name="microedition.platform" value="Nokia6230" />
</system-properties><img name="normal" src="normal.png"/>
There are three basic images making up the skin, one for the "normal" untouched device and two "over" and "pressed" for giving feedback to the user at mouse over and click gestures.
Define device display capabilities: colors, size and icons
LCDUI API fonts mapping to system fonts
<font face="FACE_SYSTEM" style="STYLE_PLAIN" size="SIZE_SMALL">
<system name="SansSerif" style="plain" size="10"/>
</font>Describes device input capabilities and buttons positions
<softbutton name="SOFT1" key="VK_F1" keyCode="-6" alignment="LEFT">
<button name="SELECT" key="VK_ENTER" keyCode="-5">name mandatory attribute (Since 2.0.2) Identify the button function: SOFT1, SOFT2, SELECT, UP, DOWN, LEFT, RIGHT, 0, 1...9
| name | key | Button function | Canvas.getGameAction(keyCode) |
| SOFT1 | VK_F1 | Left SoftKey | |
| SOFT2 | VK_F2 | Right SoftKey | |
| SELECT | VK_ENTER | Select Key | Canvas.FIRE |
| UP | VK_UP | Up | Canvas.UP |
| DOWN | VK_DOWN | Down | Canvas.DOWN |
| LEFT | VK_LEFT | Left | Canvas.LEFT |
| RIGHT | VK_RIGHT | Right | Canvas.RIGHT |
| POUND | # | ||
| ASTERISK | * |
key attribute is the computer keyboard shortcut which is defined as key. The actual key definitions are virtual key codes, which are defined in J2SE's java.awt.event.KeyEvent class. See the J2SE documentation for details. You can use integer value or String representing KeyEvent field name. For multiple key codes use space separated list.
When schema 2.0 is used this attribute identify button functions.
Also keyboardChars attribute can be used to define keyboard shortcut. e.g. # and *
keyCode optional attribute is key code reported to MIDP application (Canvas.keyPressed()).
The key code values are unique for different hardware types. The MIDP defines the following key codes in the Canvas class KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_STAR, and KEY_POUND.
Sometime game application is interested in Left SoftKey, Middle SoftKey, Right SoftKey, Select Key. These keys are not so different between devices.
For example Nokia and Sony-Ericsson phones have this value: Left SoftKey: -6, Right SoftKey: -7, Select Key: -5
Motorola devices have this value: Left SoftKey: -21, Middle SoftKey: -23, Right SoftKey -22, Select Key: -20
Motorola iden devices have this value: Left SoftKey: -20, Middle SoftKey: -22, Right SoftKey -21
more information can be found in J2ME Polish Device Database.
If keyCode is not specified the value would be selected based on the name attribute.
| Button function | name | key | keyCode |
| Left SoftKey | SOFT1 | VK_F1 | -6 |
| Right SoftKey | SOFT2 | VK_F2 | -7 |
| Select Key | SELECT | VK_ENTER | -5 |
| Up | UP | VK_UP | -1 |
| Down | DOWN | VK_DOWN | -2 |
| Left | LEFT | VK_LEFT | -3 |
| Right | RIGHT | VK_RIGHT | -4 |
modeChange boolean value. Itentify one button as mode change button for text inputs. By default # but on some phones this can be *
The Device class for Skin is optional; it can be introduced by adding class-name element to device.xml
<device> <class-name>org.microemu.devices.nokia.n6230.N6230Device</class-name> ...
public class N6230Device extends org.microemu.device.Device {
public N6230Device() {
}
}