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


3 Using Sample Projects

The Oracle Java ME SDK sample projects introduce you to the emulator's API features and the SDK features, tools, and utilities that support the various APIs. These features can help you customize the sample projects or create applications of your own.


As mentioned in Section 1.3, "Java ME SDK Update Center" the demos are delivered and installed separately. Before using the demos, please see the "Installation and Runtime Security Guidelines" in the Oracle Java Micro Edition Software Development Kit Release Notes. Some demos use network access and open ports. Because the sample code does not include protection against malicious intrusion, you must ensure your environment is secure should you choose to run the sample projects.

For instructions on running projects, see the following topics:

3.1 Creating a Sample Project

Sample applications are installed in a separate NetBeans plugin. Do not run or edit these projects directly. You create a new project that is an instance of the sample project.

The default location for Oracle Java ME SDK projects is the default NetBeans project directory. Each project has a src directory that contains Java programming language source code. For example, the default location of the source code for the SMS sender MIDlet (example.sms.SMSSend) in WMADemo resides in the following location:

userhome\My Documents\NetBeansProjects\WMADemo\src\example\sms\

  1. Go to File > New Project and in the Categories window select Samples > Java ME SDK 3.2 and single-click a sample project name. Click Next.

  2. Accept Name and Location page default values or provide your own. Click Next.

  3. Choose an emulator platform and a device. Note, changing the device affects the possible device profiles. Click Finish.

    The project is added to the Project window.


    If you can't see the Project window choose Window > Projects. To see console output, select Window > Output > Output.

  4. Set the project's default execution mode. Right-click on a project and select Properties from the context menu, then choose the Running category.

    Description of runproject-prop.gif follows
    Description of the illustration runproject-prop.gif

    If you want to install the application in the emulator each time it is run, select Execute through OTA (Over the Air Provisioning). This mode is required if your application uses the push registry or the external events generator, and optional for other cases.

    If the application does not need to be installed in the emulator, choose Regular execution (see Section 13.1, "Security Domains").

3.2 Running a Project

Create your own project, or instantiate one of the sample projects provided with the SDK as described in Section 3.1, "Creating a Sample Project".

  1. Use one of these methods to run a project.

    • Right-click the project and select Run from the context menu.

    • To run the main project (which is shown in bold text in the Projects window), click the green Run button in the toolbar or press F6. To set the main project, select Run > Set Main Project and select a project from the dropdown menu.

    • To run the project on a different device, or to change the execution mode, choose the device in the Device Selector window (Tools >Java ME > Device Selector). Right-click on a device and select Run Project or Run Project via OTA from the context menu. Pull right to see a listing of open projects. Projects that cannot run on the current device are grayed out.

      Description of runproject-context.gif follows
      Description of the illustration runproject-context.gif

    • Choose Start > Programs > Java(TM) ME Platform SDK 3.2 > Java ME SDK CLDC Emulator.

      The device emulator window opens with the demo application running. If the demo is a MIDlet suite you might have to choose a MIDlet to launch.

  2. As the sample project runs, soft keys might be enabled below the screen on the left or right side.

    You use soft keys to install or launch an application, open a menu, exit, or perform some other action. Some demos include these instructions in the application.

    For instructions on running samples, see Table 3-1 or Table 3-2.

  3. When you are finished viewing the application, go to the emulator's Application menu and select Exit to close the emulator and stop the execution of the project's build script.

    When the emulator is launched, it runs as an independent process. Pressing the red stop button in the NetBeans Output window terminates the build script, but it does not close the emulator instance. You can also terminate the build script by clicking the X next to the progress meter at the bottom of the IDE.

    Description of runproject-exit.gif follows
    Description of the illustration runproject-exit.gif

    Likewise, closing the NetBeans IDE does not affect the emulator instance. In the emulator, select Application > Exit or press the emulator's exit button (the X) on the upper right.

    This ensures that both the emulator process and the project build process close.

3.3 Troubleshooting

Sometimes even a "known good" application, such as a sample project, does not run successfully. The problem is usually your environment.

3.4 Sample Project Overview

The Oracle Java ME SDK includes demonstration applications that highlight some technologies and APIs that are supported by the emulator.

Most demonstration applications are simple to run. Section 3.2, "Running a Project" contains instructions for running most demonstrations. Sample projects usually have some additional operation instructions.

Table 3-1 lists all the MIDP/CLDC demonstration applications that are included in this release.

Table 3-1 MIDP/CLDC Sample Projects

Sample Optional Package Description Instructions

Advanced Multimedia Supplements

JSR 234

Demonstrates 3D audio, reverberation, image processing, and camera control.

Section 3.7.1, "Running the AdvancedMultimediaSupplements Sample Project"



Demonstrates audio capabilities, including mixing and playing audio with an animation.

Section 19.4, "Running AudioDemo"


JSR 82

Demonstrates device discovery and data exchange using Bluetooth.

Section 18.2, "Running the Bluetooth Demo"


JSR 211

A content viewer that also uses MediaHandler.

Section 25.4, "Running the CHAPIDemo Content Browser"


JSR 179

A city map that displays landmarks based on the current location.

Section 22.2, "Running the CityGuide Sample Project"


JSR 257

Emulates detection of RFID tags.

Section 29.1, "Using ContactlessDemo"


JSR 184

Contains MIDlets that demonstrate how to use 3D graphics, both immediate mode and retained mode.

Section 24.4, "Running Demo3D Samples"


MIDP 2.0

Includes various examples: animation, color, networking, finance, and others.

Section 3.7.2, "Running the Demos Sample Project"


CLDC 1.1

Simple floating point calculator.

Section 3.7.3, "Running FPDemo"


MIDP 2.0

Includes TilePuzzle, WormGame, and PushPuzzle.

Section 3.7.4, "Running Games".


JSR 172

Demonstrates how to use the JSR 172 API to connect to a web service from a MIDlet.

Section 20.3, "Run JSR172Demo"



Demonstrates LWUIT features.

Chapter 12, "Lightweight UI Toolkit"



Demonstrates LWUIT features.

Chapter 12, "Lightweight UI Toolkit"



Demonstrates LWUIT features.

Chapter 12, "Lightweight UI Toolkit"



Demonstrates LWUIT features.

Chapter 12, "Lightweight UI Toolkit"



Demonstrates LWUIT features.

Chapter 12, "Lightweight UI Toolkit"



Demonstrates LWUIT features.

Chapter 12, "Lightweight UI Toolkit"



Demonstrates LWUIT features.

Chapter 12, "Lightweight UI Toolkit"



Demonstrates MMAPI features, including tone sequences, MIDI playback, sampled audio playback, and video.

Section 19.5, "Running MMAPIDemos"



Demonstrates different video playback formats.

Section 19.5.3, "Video"


MIDP 2.0

Demonstrates how to use datagrams and serial connections.

Section, "Socket Demo" and Section, "Datagram Demo"


JSR 82

Demonstrates device discovery and data exchange using Bluetooth.

Section 18.3, "Running the OBEX Demo"


JSR 75

Demonstrates how to manipulate contacts, calendar items, and to-do items. Demonstrates accessing local files.

Section 17.3, "Running PDAPDemo"


MIDP 2.0

Demonstrates a variety of image formats.

Section 3.7.6, "Running PhotoAlbum"


JSR 177

Demonstrates communication with a smart card and other features of SATSA.

Section 21.4, "Running SATSADemos"


JSR 177

Shows how to use the SATSA-Java Card Remote Invocation method.

Section 21.4.5, "Running SATSAJCRMIDemo"


JSR 256

The SensorBrowser and Marbles game demonstrate sensor input.

Section 28.4, "SensorBrowser" and Section 28.5, "Marbles"


JSR 226

Uses SVG to create a contact list displayed with different skins.

Section 26.2, "Running SVGContactList"


JSR 226

Uses different SVG rendering techniques.

Section 26.1, "Running SVGDemo"


MIDP 2.0

Showcases the breadth of MIDP 2.0's user interface capabilities.

Section 3.7.7, "Running UIDemo"


WMA 2.0

Shows how to send and receive SMS, CBS, and MMS messages.

Section 23.2, "Running WMADemo"


JSR 280

Uses DOM and STAX APIs to create an XML sample and SAX, DOM and StAX APIs to parse the sample.

Follow the instructions the application provides.

Table 3-2 lists the CDC sample projects available in this release.

Table 3-2 CDC Sample Projects

Sample Optional Package Description Instructions


JSR 209

This stand-alone application is a Java SE application adapted for the CDC environment. It demonstrates the graphical and animation capabilities of the Java 2D™ API.

Click the blue arrows to page through the various images and animations. The applications focus on curves. Click the AA icon to see how antialiasing affects appearance.


JSR 209

Functional tools such as buttons, sliders, and menus implemented with Swing.

Click through the tabs to view the controls and animations.

3.5 Configuring the Web Browser and Proxy Settings

If you are behind a firewall you must configure the proxy server so that MIDP applications using web services can succeed.


CDC emulators do not work through a proxy. Communications such as downloading images from the Internet fail on CDC emulators.

The settings are typically the same as those you are using in your web browser.

  1. Select Tools > Options > General.

  2. Choose a Proxy Setting:

    • No Proxy

    • Use System Proxy Settings

    • Manual Proxy Settings

      To set the HTTP Proxy, fill in the proxy server address field and the port number. The HTTP Proxy Host is the host name or numeric IP address of the proxy server used to connect to HTTP and FTP sites. The Proxy Port is the port number of the proxy server.

      To set the HTTPS or Socks proxy, click More and fill out the Advanced Proxy Options form.

3.6 Resolving Reference Problems

Sometimes when you open a project you can see it has a reference warning. In the Projects tab the project name is red, and the icon shows a warning symbol, as seen below:

project with reference problem has red warning icon

Usually this warning means the project refers to a platform, file, or library that cannot be found.

If you are using an old project it might be referring to a platform or device that is not installed. In this case edit the project properties and select an available platform and device as described in Section 2.2.1, "Java ME Platforms", then rebuild the project.

If the problem is not the platform, right-click on the project and choose Resolve Reference Problems.

Description of reference-problem2.gif follows
Description of the illustration reference-problem2.gif

The window displays the missing file, the problem, and a possible solution. In this case the project probably used a literal path to the file keystore.ks. Clicking the Resolve... button opens a file browser so you can find the missing keystore file. The default location is as follows:


Locate and select the file. You receive confirmation that the problem is resolved, and you can now click Close.

3.7 Running MIDP and CLDC Sample Projects

This topic gathers MIDP and CLDC samples that are not discussed in separate chapters. This is the case when a sample uses many JSRs, or when a supported JSR does not have any special implementation details.

For other CLDC demos, see Table 3-1.

3.7.1 Running the AdvancedMultimediaSupplements Sample Project

This MIDlet suite demonstrates the power of JSR 234 Advanced Multimedia Supplements (AMMS). It consists of the following MIDlets:

Section, "Image Effects"
Section, "Camera"
Section, "Moving Helicopter"
Section, "Music Effects" Image Effects

This MIDlet demonstrates standard image processing operations.

  • Launch the Image Effects MIDlet.

  • Choose input and output image formats, and press Done. The input image and output images are displayed simultaneously.

  • Choose an effect from the Menu and click the Done button to apply a transformation, effect or overlay. The source image is shown above and the processed image is shown below. Some items, Set Transforms, for example, can perform several operations in a single transaction.

    The menu options are as follows:

    • Reset - Set transforms, effects, and overlays to the initial state.

    • Monochrome Effects - Activate grayscale rendering.

    • Negative Effect -Reverse dark and light areas.

    • Set Formats - Select an input object type and an output image format.

    • Set Effect Order - Specify the order in which transforms, effects and overlays are applied.

    • Set Transforms - Change width and height scale, border, and rotation options.

    • Set Overlays - Specify the color and orientation of a color block overlay. Music Effects

Demonstrates the advanced audio capabilities of the Advanced Multimedia Supplements. As an audio file loops continuously, you can adjust the volume, and reverberation settings. Camera

This MIDlet demonstrates how the Advanced Multimedia Supplements provide control of a device's camera. The screen shows the viewfinder of the camera (simulated with a movie). You can use commands in the menu to change the camera settings and take and manage snapshots.

  • Zoom settings - digital and optical zoom settings 100-300 in increments of 20. Make a selection and press Back.

  • View gallery - View a list of the snapshots stored in: userhome\javame-sdk\3.2\work\device\appdb\filesystem\root1. Choose Display to see the snapshot. You have the option to delete the file from disk.


  • Change F_Stop number - 0, 400, 560, 800, 1600.

  • Choose exposure modes - Preset modes are auto, landscape, snow, beach, sunset, night, fireworks, portrait, backlight, spotlight, sports, text.

  • Disable/Enable shutter feedback.

  • Exit - Close this MIDlet and return to the initial window.

  • Snapshot setting - Set whether to display the snapshot on the screen or print it to a file. Snapshots are stored in:

    userhome\javame-sdk\3.2\work\emulator_name\appdb\filesystem\root1 Moving Helicopter

Simulates a helicopter (red dot) flying around a stationary observer (blue dot). Use headphones for best results. You can control the parameters of the simulation with the soft menu options: Volume, Location settings, Spectator orientation, and Distance Attenuation settings. After viewing menu options, press the close button (the X on the right) to return to the helicopter scenario.

With the Location settings be aware that supplying large values for the screen width or flight altitude means the helicopter might be out of range - that is, it flies off the screen and you might not be able to hear it.

For spectator orientation stereo headphones or speakers help detect the difference in position, assuming your volume and location settings put the helicopter in audible range. The same is true for the Distance Attenuation settings, which enable you to control the doppler effect.

3.7.2 Running the Demos Sample Project

This demo contains several MIDlets that highlight different MIDP features. Click or use the navigation keys to highlight a MIDlet, then choose the Launch soft key. Colors

This application displays a large horizontal rectangle that runs the width of the screen. Below, ten small vertical rectangles span the screen. Finally, three horizontal color bars indicate values for blue, green, and red (RGB). Values are expressed as decimal (0-255) or hexadecimal (00-ff) based on the first menu selection.

  • To select a vertical bar to change, use the up navigation arrow to move to the color bars. Use the right navigation arrow to highlight a color bar. The large rectangle becomes the color of the selected bar.

  • Use the up or down selection arrows to choose the value to change (red, green, or blue). Use the left or right arrow keys to increase or decrease the selected value. The second menu item enables you to jump in increments of 4 (Fine) or 32 (coarse).

  • You can change the color on any or all of the vertical bars. Properties

This MIDlet displays your system property values. The output is similar to the following values:

Free Memory = 2333444
Total Memory = 4194304
microedition.configuration = "CLDC-1.1"
microedition.profiles = "MIDP-2.1"
microedition.platform = "j2me"
microedition.platform = "en-US"
microedition.platform = "IS08859_1" Http

This test application uses an HTTP connection to request a web page. The request is issued with HTTP protocol GET or POST methods. If the HEAD method is used, the head properties are read from the request.

Preparing to Run the Demo

Before beginning, examine your settings as follows.

  • Right-click on Demos and select Properties.

    • Select the Running category.

    • Select Regular Execution.

    • Check Specify the Security Domain and select Maximum.

    • Click OK.

  • If you are using a proxy server, you must configure the emulator's proxy server settings as described in Section 3.5, "Configuring the Web Browser and Proxy Settings". The HTTP version must be 1.1.

  • If you are running antivirus software it might be necessary to create a rule that allows your MIDlet to permit connections to and from a specific web site. See Section 3.3, "Troubleshooting".

Running the Demo

Launch the Http MIDlet. To test, choose the Menu soft key and choose Get, Post, or Head to test the selected URL.

Http Test returns the information it obtains. If the information fills the screen use the down arrow to scroll to the end. The amount of information depends on the type of request and on the amount of META information the page provides. To provide body information or content, the page must declare CONTENT-LENGTH as described in RFC 2616.

Using Menu Options

Use the Menu soft key to choose an action. The Menu items vary depending on the screen you are viewing.

  • Choose Qwerty to set the input type. This activates a submenu with the options Qwerty, 123, Abc, Predict, and Symbols. This choice is present if you have the option to edit a URL (select Choose, then click the Add soft button).

  • Choose GET or press the Get soft key to retrieve data from the selected URI.

  • Choose POST to retrieve the post information from the server handling the selected page.

  • Choose HEAD to retrieve only the META information from the headers for the selected URI.

  • Select Choose to bring up the current list of web pages. You can chose a different page or add your own page to the list. To specify a new URL, choose the Add soft button. The screen displays http://. Type in the rest of the URL. If necessary select Qwerty on the menu and choose a different input method. Be sure to end with a slash (/). For example Press the OK soft button. The Http Test screen shows your new URL and prompts for an action. FontTestlet

This MIDlet shows the various fonts available: Proportional, Regular, Regular Italic, Bold Plain, and Bold Italic. Choose 1 or 2 from the menu to toggle between the system font (sans serif) and the monospace font. Stock

Like the Http demonstration, this sample uses an HTTP connection to obtain information. Use the same preparation steps as Section, "Http".

Run the Demos project and launch the Stock MIDlet.

By default, the screen displays an empty ticker bar at the top. Below the ticker, the menu list shows four applications: Stock Tracker, What If? Alerts, and Settings. You must add stock symbols before you can use the first three applications.

Add Stock Symbols to the Ticker

To add a stock symbol to the ticker, use the navigation arrows to select Settings.

Select Add Stock.

The display prompts you to enter a stock symbol. Type ORCL and select the Done soft key. The stock you added and its current value is now displayed in the ticker. Add a few more stock symbols, such as IBM and HPQ.

Change the Update Interval

By default the update interval is 15 minutes. Select Updates to change the interval. Use the navigation arrows to select one of Continuous, 15 minutes, 30 minutes, one hour, or three hours. Select the Done soft key.

Remove a Stock

Select Remove a Stock. You see a list of the stocks you have added. Use the navigation keys to select one or more stocks to remove. Choose the Done soft key.

Stock Tracker

Stock Tracker displays a list of the stocks you added and their current values. Stock tracker displays additional information about the selected stock, for example, the last trade and the high and low values.

Choose a stock and press Select.

What If?

What If? is an application that asks for the original purchase price and the number of shares you own. It calculates your profit or loss based on the current price.

Select a stock symbol.

Enter the purchase price and the number of shares, then press Calc.


This application sends you a notification when the price changes to a value you specify.

From the main menu, select Alerts.

Select Add.

Choose a Stock. The screen prompts, "Alert me when a stock reaches". Enter an integer.

The alert is placed on the Current Alerts list. To remove an alert, press Remove and select the alert. Choose the Done soft key.

When the value is reached you hear a ring and receive a message. For example, Symbol has reached your price point of $value and is currently trading at $current_value. When the alert is triggered it disappears from the Current Alerts list. Tickets

This demonstrates how an online ticket auction application might behave. The home screen displays a ticket ticker across the top. Click Done to continue to the Welcome To Tickets page. The Choose a Band field displays BootWare & Friends by default.

Choose a band from the dropdown menu. The available auction appears.

Select Make a Bid from the menu. Use the arrow keys to move from field to field. Fill out each field, then select the Next soft key. The application asks you to confirm your bid. Press the Submit soft key or use the arrow keys to highlight Submit then press Select. You receive a Confirmation number. Click Bands to return to the Bands page.

Select set an alert, select Set an Alert from the soft Menu. In the bid field type in a value higher than the current bid and click the Save soft key. You are returned to the Choose a Band page. You can trigger the alert by making a bid that exceeds your alert value. Your settings determine how often the application checks for changes, so the alert may not sound for a few minutes.

To add a band to the Choose a Band dropdown list, select the Menu soft key and choose Add Bands. Type in a band name or a comma-delimited list of names. Choose the Save soft key. After confirmation you are returned to the Welcome To Tickets page. The added band(s) are displayed at the end of the Choose a Band drop-down menu.

Note, this is only a demonstration. To fully describe the band you must edit the following file:

userhome\My Documents\NetBeansProjects\Demos\src\example\auction\

To remove a band, select the Menu soft key and Remove Bands. Check a box for one or more bands. Choose the Save soft key.

To display the current settings for ticker display, updates, alert volume, and date, select the Menu soft key and choose 6. If desired, use the arrow keys and the select key to change these values. Choose the Save soft key. ManyBalls

This MIDlet starts with one ball traveling the screen. Use the up and down arrows to accelerate or decelerate the ball speed (fps). Use the right or left arrows to increase or decrease the number of balls. MiniColor

This MIDlet sets an RGB value. Use navigation keys to change color values.

Keyboard controls work as you would expect. First cursor up or down to highlight a color, and then use left and right keys to lower and raise the value of the selected color. Chooser

The Chooser application uses a variety of controls to change text color, background color, and fonts.

  • Choose Menu > Text Color. Change the color as described for MiniColor and select the OK soft button.

  • Choose Menu > Background Color. Change the color as described for MiniColor and select the OK soft button.

  • Choose Menu > Fonts. You can change the font Face, Style, and Size.

    Cursor up and down to highlight a property, then select. The left and right keys jump between lists. Up and down keys move item by item.

    Click OK to continue. HttpExample

This sample makes an HTTP communication. A popup confirms the transaction was successful. HttpView

This application displays three predefined URLs.

Choose a URL, and press the soft buttons to cycle through Head, Headers, Requests, and Errors.

Alternatively, Use the menu options. PushExample

This application simulates a feed. As soon as you connect, you receive and display a graphic. Select Done to continue.

3.7.3 Running FPDemo

FPDemo is a simple floating point calculator.

  1. Enter a number in the first field.

  2. To choose an operator, highlight the drop-down list and click to select. Cursor down to highlight an operator, then click to make a selection.

  3. Enter a second value.

  4. From the Menu, select Calc or choose 2 to calculate the result.

3.7.4 Running Games

This application features three games: TilePuzzle, WormGame, and PushPuzzle.

TilePuzzle. The desired result, "Rate your mind pal" is shown first. From the soft Menu, select 1, Start. The scrambled puzzle is displayed. The arrow keys move the empty space, displacing tiles accordingly (the arrow key indicates which tile to swap with the space). From the menu you can Reset, or change options.

WormGame. From the soft Menu, select 1, Launch. Use the arrow keys to move the worm to the green box without touching the edge of the window. When the game is launched, use the soft menu to change game options.

PushPuzzle. Use the blue ball to push the orange boxes into the red squares in the fewest number of moves.

3.7.5 Running Network Demo

This demo has two MIDlets: Socket Demo and Datagram Demo. Each demo requires you to run two emulator instances so that you can emulate the server and client relationship. For example, run the demo on JavaMEPhone1 and JavaMEPhone2. Socket Demo

In this application one emulator acts as the socket server, and the other as the socket client.

  1. In the first emulator, launch the application, then select the Server peer. Choose Start. The Socket Server displays a status message that it is waiting on port 5000.

  2. In the second emulator, launch the application, select the Client peer, then choose Start. Choose Start to launch the client. The Socket Client displays a status message that indicates it is connected to the server on port 5000. Use the down navigation arrow to highlight the Send box. Type a message in the Send box, then choose the Send soft key.

    For example, in the client, type Hello Server in the Send box. Choose Send from the menu. The server emulator activates a blue light when the message is received.

  3. On the emulator running the Socket Server, the status reads: Message received - Hello Server. You can use the down arrow to move to the Send box and type a reply. For example, Hello Client, I heard you. From the menu, select Send.

  4. Back in the Socket Client, the status is: Message received - Hello Client, I heard you. Until you send a new message, the Send box contains the previous message you sent. Datagram Demo

This demo is similar to Socket Demo. Run two instances of the emulator. One acts as the datagram server, and the other as the datagram client.

  1. In the first emulator, launch Datagram Demo, then select the Server peer. Choose Start. Initially, the Datagram Server status is Waiting for connection on port 5555, and the Send box is empty.

  2. In the second emulator, launch Datagram Demo, select the Client peer, ensure the port number is 5555 and choose Start. The Datagram Client status is: Connected to server on port 5555. Use the down navigation arrow to highlight the Send box. Type a message in the Send box, then choose the Send from the menu. For example, type Hello datagram server. From the menu, select Send.

  3. On the emulator running the Datagram Server, the status displays: Message received - Hello datagram server. You can use the down arrow to move to the Send box and type a reply to the client.

  4. In the Datagram Client, the status field displays the message received from the server. The Send box contains the last message you sent. Overwrite it to send another message.

3.7.6 Running PhotoAlbum

The PhotoAlbum demo displays both static and animated images. When you are displaying an image, you can use the Options soft menu to change the borders. If the image is animated, you can change the speed of the playback.

3.7.7 Running UIDemo

UIDemo showcases a variety of MIDP user interface element implementations. Most elements have some interactive capability (navigate and select) and some allow keypad or keyboard input.

Input interaction is similar across demos. You can choose items from lists or type in data.

This demo implements three list selection methods:

  • Exclusive (radio buttons)

  • Multiple (check boxes)

  • Pop-Up (a drop list).

When entering data, you can use the soft menu to apply one of the following input types to text boxes and fields (note, some elements do not use all input types). When a field is selected, the soft Menu label displays Qwerty. Open the menu and you see the input types numbered 1 through 5.

  1. Qwerty. Any character on the keyboard

  2. 123. Any numeral

  3. ABC. Any letter

  4. Predict. Predicts next character based on prior input

  5. Symbols. Opens a list of symbols; click to make a selection.

  6. Virtual. Click keys on a virtual keyboard to enter data.

The Qwerty, 123, and ABC categories act as filters. For example, if you assign 123 to a field and you type "abc", nothing is entered in the field.

When you finish a demo, select the home button to return to the UIDemo launch page: back button

CustomItem. This demo features text fields, and text fields in table form. To type in the table, select a cell, then click to open a text entry panel and type your input. From the menu, select OK.

StringItem. Displays labels, a hyperlink, and a button. The soft menu action varies depending on the selected element.

Gauge. Interactive, non-interactive, indefinite and incremental gauges.

Alert. Uses pop-ups to display alerts. Set the alarm type and the length of the timeout from drop lists. Select the alert type and select the Show soft button.

ChoiceGroup. Radio buttons, check boxes, and pop-ups on one screen.

List. Select exclusive, implicit, or multiple to display the list type on a subsequent screen.

TextBox. Use text fields, radio buttons, check boxes, and pop-ups. Select a text box type and press the Show button.

TextField. Text fields with the six input types.

DateField. Set date and time using drop lists.

Ticker. A scrolling ticker.

3.8 Running IMP-NG Sample Projects

This section describes how to use demos created specifically for the IMP-NG platform (see Section 2.1.2, "IMP-NG"). Because IMP-NG is headless the only user interface is to observe application status in the emulator's external events generator, or in the Output window (or the console if you execute the demo from the command line).

With the exception of I2CDemo, the sample projects in this section can be run on the emulator or on a real device.

3.8.1 GPIODemo

This demo can be run on an emulator or a real device. The implementations are different, as the emulator uses the external events generator, and the real device supports direct interaction.

GPIODemo on the Emulator

  • Run GPIO demo on an IMP-NG emulator.

  • Click the GPIO tab. This view approximates the device actions.

  • Choose Device > GPIO to open the external events generator, and click the GPIO tab. A single click on a button turns on LEDs indicating the button pushed and the pin affected. This information is also written to the Output window.

    Beneath each pin you can click the blue wave button to open the wave generator. The wave generator simulates the frequency and duration of the signal to the LED.

  • Press Pin 5 (button 1) to turn on LED 1, press again to turn off LED 1.

  • Press Pin 6 (button 2) to turn on LED 2, press again to turn off LED 2.

  • Press Pin 7 (button 3) and check whether PORT 1's output value is 3. Press PIN 7 and check whether PORT 1's output value is 0.

3.8.2 I2CDemo

This demo is designed to work with the IMP-NG runtime for Windows 32 . It has no user interaction.

  • Launch the I2C demo.

  • In the emulator, click the I2C tab.

    The demo acquires a slave named I2C_Echo, writes data to the slave, and retrieves it. The demo is successful if the Sent Data and Received Data matches.

3.8.3 NetworkDemoIMPNG

This demo is a headless version of Section, "Socket Demo".

This demo can be configured as a server or as a client by editing the application descriptor. You launch two instances of this demo, the first one acts as a server and the second one acts as a client. The client instance attempts to connect to the server instance and if the connection is successful they exchange a message.

NetworkDemoIMPNG on the Emulator

  • Create two instance projects of the NetworkDemoIMPNG sample project.

  • Right click on the first project and select Properties. In the Platform category choose the device IMPNGPhone1. In the Application Description category set the value of the property Oracle-Demo-Network-Mode to Server and click OK.

  • Launch the first project. It opens on the emulator IMPNGPhone1 and waits for a connection.

  • Right click on the second project and select Properties. In the Platform category choose the device IMPNGPhone2. In the Application Description category set the value of the property Oracle-Demo-Network-Mode to Client and click OK.

  • Launch the second project. It opens on the emulator IMPNGPhone2.

  • The client attempts to connect to the server. If successful, you see the following in the output tab of the first project (the server):

    Connection accepted
    Message received - Client messages

    The output of the second project (the client) shows the following:

    Connected to server localhost on port 5000
    Message received - Server String


This demo is a headless version of the PDAPDemo file browser in Section 17.3.1, "Browsing Files".

PDAPDemoIMPNG on the Emulator

Follow these steps to run the demo on the emulator:

  • Create test files and directories inside the emulator's file system:

    Documents and Settings\user\javame-sdk\version\work\IMPNGPhone1\appdb\filesystem\root1

  • Right click on the project and select Properties. In the Platform category choose the device IMPNGPhone1 and click OK.

  • Launch the project. It runs on IMPNGPhone1.

  • On the emulator menu, select Device > File Connection to see a list of mounted file systems.

  • Open a terminal emulator and create a raw connection to localhost on port 5001.

  • A command line opens where you can browse the emulator's file system. You can use the following commands:

    • cd - change directory

    • ls - list information about the FILEs for the current directory

    • new - create new file or directory

    • prop - show properties of a file

    • rm - remove the file

    • view -View a file's content