Sun s MIDP Emulator

Team-Fly

Sun's MIDP Emulator

Sun's MIDP reference implementation includes an emulator named midp. It emulates an imaginary MID, a mobile telephone with some standard keys and a 98 × 130-pixel screen. The J2MEWTK includes an almost identical emulator, as well as a pager emulator.

Running MIDlets

Once you've got a preverified class file, you can use the midp emulator to run it. The emulator is an application that runs under J2SE that acts just like a MID. It shows itself on your screen as a representative device, a generic mobile phone. You can run your MIDlet by typing the following at the command line, assuming you added \midp\bin to your PATH:

 midp Jargoneer 

Or, if you're using the J2MEWTK, you can simply choose an emulator from the Device combo box and click the Run button to fire up the emulator.

If all goes well, you'll see something like the window shown in Figure 2-1. Congratulations! You've just built and run your first MIDlet.

click to expand
Figure 2-1: Buttons on the mobile phone emulator

Using the Emulator Controls

The J2MEWTK emulator appears as a generic mobile phone, as shown in Figure 2-1.

Sun's J2MEWTK emulator exhibits several qualities that you are likely to find in real devices:

  • The device has a small screen size and limited input capabilities.

  • Two soft buttons are available. A soft button does not have a fixed function. Generally, the function of the button at any given time is shown on the screen near the button. In MIDlets, the soft buttons are used for commands.

  • Navigation buttons are provided to allow the user to browse through lists or other sets of choices.

  • A select button allows the user to make a choice after moving to it with the navigation buttons. (Think "Yes, that's my final answer.")

Environment Variables

The emulator included with Sun's MIDP reference implementation can be controlled via environment variables. One of the most interesting ones is SCREEN_DEPTH, which determines the bit depth of the emulator's screen. Possible values are shown in Table 2-1.

Table 2-1: SCREEN_DEPTH Values

VALUE

MEANING

1

Black and white

2

Grayscale, 4 levels

4

Grayscale, 16 levels

8

Color, 256 colors

SCREEN_DEPTH and the other environment variables that can be used are documented in the docs\midp-env.html installed in the reference implementation directory.

The Wireless Toolkit Devices

The J2MEWTK includes the four device emulators that follow:

  • DefaultColorPhone is basically the emulator shown in Figure 2-1 with a screen depth of 8. The screen measures 98 × 130 pixels.

  • DefaultGrayPhone is the same emulator with a screen depth of 4.

  • MinimumPhone is a stripped-down mobile phone with a 96 × 54-pixel screen, the smallest allowed by the MIDP specification.

  • Pager is a generic pager.

You can easily switch to a different emulator by choosing it from the Device combo box.


Team-Fly


Wireless Java. Developing with J2ME
ColdFusion MX Professional Projects
ISBN: 1590590775
EAN: 2147483647
Year: 2000
Pages: 129

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net