Sun's J2ME Wireless Toolkit Emulators
Sun's J2ME Wireless Toolkit Emulators
The J2ME Wireless Toolkit includes several different emulators that you can use to test your applications. When you click the Run button in the J2ME Wireless Toolkit, your application is launched in the currently selected emulator.
The Wireless Toolkit Devices
The J2ME Wireless Toolkit 2.0 (in its beta 2 release) contains four main device emulators:
-
DefaultColorPhone is a device with a 180 × 208-pixel color screen. This is the device shown in Figure 2-2 and is used for most of the screen shots in the remainder of this book.
Figure 2-2: Buttons on the J2ME Wireless Toolkit emulator
-
DefaultGrayPhone is the same as DefaultColorPhone but has a grayscale screen.
-
MediaControlSkin looks like the default phone emulator but its buttons are labeled with controls like a music player: a square for stop, a triangle for play, volume control buttons, etc.
-
QwertyDevice is a smartphone with a 640 × 240-color screen and a miniature qwerty keyboard.
Running MIDlets
If you're using the J2ME Wireless Toolkit, you can simply choose an emulator from the Device combo box and click the Run button to fire up your application.
Sun's MIDP reference implementation includes an emulator named midp. It emulates an imaginary MID, a mobile telephone with some standard keys and a 182 × 210-pixel screen. The J2ME Wireless Toolkit includes an almost identical emulator, as well as several others.
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 and acts just like a MIDP device. 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:
If all goes well, you'll see something like the window shown in Figure 2-2. Congratulations! You've just built and run your first MIDlet.
Using the Emulator Controls
The J2ME Wireless Toolkit emulator appears as a generic mobile phone, as shown in Figure 2-2.
Sun's J2ME Wireless Toolkit emulator exhibits several qualities that you are likely to find in real devices:
-
The device has a small screen size and limited input capabilities. (It's not as small as the J2ME Wireless Toolkit 1.0 emulators, which included emulated devices with 96 × 128 and 96 × 54-pixel screens.)
-
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.")
641 times read
|
|
|
|