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

Previous
Previous
 
Next
Next
 

3 Using Sample Projects

The 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.

The source code for every demonstration application is available in the installation's \apps directory. Subdirectories contain projects, and each project has a src directory that contains Java programming language source code.

For example, if the SDK is installed in installdir, the source code for the SMS sender MIDlet (example.sms.SMSSend) in WMADemo resides in the following location:

installdir\apps\WMADemo\src\example\sms\SMSSend.java

For instructions on running projects, see the following topics:

3.1 Running a Project

To run a sample project, go to the Java ME SDK Start Page tab and single-click a sample project name. The project opens in the Project window and starts running in the emulator.


Note:

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


Follow these steps to run your own projects.

  1. Select File > Open Project, and browse to select a project.

    The project is added to the Projects window.

  2. 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 a project as main, right-click the project name and select Set as Main Project.

    To run the project on a different device, choose the device in the Device Selector window. Right-click on a device and select Run Project 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

    The device emulator window opens with the demo application running.

  3. As the sample project runs, you might need to press one of the soft keys 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.

  4. 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.

Once the emulator is launched, it is an independent process.

Pressing the red stop button in the Output window terminates the build script, but it does not close the emulator.

Likewise, closing the NetBeans IDE does not affect the emulator. 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.2 Troubleshooting

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

3.3 Sample Project Overview

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

Most demonstration applications are simple to run. Section 3.1, "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.6.1, "Running the AdvancedMultimediaSupplements Sample Project"


AudioDemo

MMAPI 1.1

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

Section 18.4, "Running AudioDemo"


BluetoothDemo

JSR 82

Demonstrates device discovery and data exchange using Bluetooth.

Section 17.2, "Running the Bluetooth Demo"


CHAPIDemo

JSR 211

A content viewer that also uses MediaHandler.

Section 25.4, "Running the CHAPIDemo Content Browser"


CityGuide

JSR 179

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

Section 21.2, "Running the CityGuide Sample Project"


CityGuide2_0

JSR 293

Similar to CityGuide, but with additional Location API 2.0 features.

Section 21.3, "Running the CityGuide2_0 Sample Project"


ContactlessDemo

JSR 257

Emulates detection of RFID tags.

Section 32.1, "Using ContactlessDemo"


Customization

JSR 258

Demonstrates the use of a device's UI themes.

Section 33.1, "Running the Customization Sample Project"


Demo3D

JSR 184

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

Section 23.4, "Running Demo3D Samples"


Demos

MIDP 2.0

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

Section 3.6.2, "Running the Demos Sample Project"


FPDemo

CLDC 1.1

Simple floating point calculator.

Section 3.6.3, "Running FPDemo"


Games

MIDP 2.0

Includes TilePuzzle, WormGame, and PushPuzzle.

Section 3.6.4, "Running Games".

I18nDemo

JSR 238

Includes string sorting, number formatting, and a phrase translator.

Section 28.3, "Running i18nDemo"


JBricks

JSR 229

A game that uses the Payment API for buying extra lives or levels.

Section 27.2, "Running JBricks"


JSR172Demo

JSR 172

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

Section 19.3, "Run JSR172Demo"


LWUITBrowser

N/A

Demonstrates LWUIT features.

Chapter 11, "Lightweight UI Toolkit"


LWUITDemo

N/A

Demonstrates LWUIT features.

Chapter 11, "Lightweight UI Toolkit"


LWUITIODemo

N/A

Demonstrates LWUIT features.

Chapter 11, "Lightweight UI Toolkit"


LWUITMakeover

N/A

Demonstrates LWUIT features.

Chapter 11, "Lightweight UI Toolkit"


LWUITSpeed

N/A

Demonstrates LWUIT features.

Chapter 11, "Lightweight UI Toolkit"


LWUITTimeZone

N/A

Demonstrates LWUIT features.

Chapter 11, "Lightweight UI Toolkit"


LWUITTipster

N/A

Demonstrates LWUIT features.

Chapter 11, "Lightweight UI Toolkit"


MMAPIDemos

MMAPI

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

Section 18.5, "Running MMAPIDemos"


MtaDemo

JSR 253

Demonstrates how MTA features can be used to simulate telephony actions.

Section 31.2, "Running the MtaDemo"


Multimedia

MMAPI

Demonstrates different video playback formats.

Section 18.5.2.1, "Video"


NetworkDemo

MIDP 2.0

Demonstrates how to use datagrams and serial connections.

Section 3.6.5.1, "Socket Demo" and Section 3.6.5.2, "Datagram Demo"

ObexDemo

JSR 82

Demonstrates device discovery and data exchange using Bluetooth.

Section 17.3, "Running the OBEX Demo"


PDAPDemo

JSR 75

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

Section 16.3, "Running PDAPDemo"


PhotoAlbum

MIDP 2.0

Demonstrates a variety of image formats.

Section 3.6.6, "Running PhotoAlbum"


SATSADemos

JSR 177

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

Section 20.4, "Running SATSADemos"


SATSAJCRMIDemo

JSR 177

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

Section 20.4.5, "Running SATSAJCRMIDemo"


Sensors

JSR 256

The SensorBrowser and Marbles game demonstrate sensor input.

Section 30.4, "SensorBrowser" and Section 30.5, "Marbles"

SIPDemo

JSR 180

Simple message exchange using SIP.

Section 24.2, "Running SIPDemo"


SVGContactList

JSR 226

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

Section 26.1.9, "Running SVGContactList"


SVGDemo

JSR 226

Uses different SVG rendering techniques.

Section 26.1, "Running SVGDemo"


UIDemo

MIDP 2.0

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

Section 3.6.7, "Running UIDemo"


WMADemo

WMA 2.0

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

Section 22.2.3, "Sending SMS Messages From WMA Console to an Emulator and Back"


XMLAPIDemo

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

AGUIJava2DDemo

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.

AGUISwingSet2

JSR 209

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

Click through the tabs to view the controls and animations.


3.4 Configuring the Web Browser and Proxy Settings

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


Note:

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.

  2. Select the General options icon.

  3. In the Web Browser field, choose the browser that will be affected by these proxy settings. Click Edit to add or remove a browser from the dropdown list.

  4. 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 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.5 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 file or library that cannot be found. 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:

installdir\runtimes\cldc-hi\lib

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

3.6 Running MIDP and CLDC Sample Projects

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

For other CLDC demos, see Table 3-1.

3.6.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 3.6.1.1, "Image Effects"
Section 3.6.1.2, "Camera"
Section 3.6.1.3, "Moving Helicopter"
Section 3.6.1.4, "Music Effects"

3.6.1.1 Image Effects

This MIDlet demonstrates standard image processing operations.

  • Select the Image Effects MIDlet and press the Launch soft button.

  • 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. Note that some items, Set Transforms, for example, can perform several operations in a single transaction.

    The menu options are as follows:

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

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

    3. Set Overlays - Specify the color and orientation of a color block overlay.

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

    5. Monochrome Effects - Activate grayscale rendering.

    6. Negative Effect -Reverse dark and light areas.

3.6.1.2 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.

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

  2. Snapshot setting - Set whether to display the snapshot on the screen or print it to a file. If the picture is saved to a file, set the snapshot action: Freeze the viewfinder, Freeze and confirm (soft button prompts you to save and you get a confirmation), Save without freezing (set the picture number). Snapshots are stored in userhome\javame-sdk\3.0.5\work\emulator_number\appdb\filesystem\root1.

  3. Disable/Enable shutter feedback.

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

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

  6. Set flash mode - Off, AUTO, AUTO_WITH_REDEYEREDUCE, FORCE, FORCE_WITH_REDEYEREDUCE, FILLIN.

  7. View gallery - View the snapshots stored in: userhome\javame-sdk\3.0.5\work\emulator_number\appdb\filesystem\root1.

  8. Zoom settings - digital and optical zoom settings 100-300 in increments of 20.

3.6.1.3 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 will fly off the screen and you might not be able to hear it.

For spectator orientation stereo headphones or speakers will 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 allow you to control the doppler effect.

3.6.1.4 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.

3.6.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.

3.6.2.1 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 allows you to jump in increments of 4 (Fine) or 32 (coarse).

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

3.6.2.2 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"

3.6.2.3 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.4, "Configuring the Web Browser and Proxy Settings". The HTTP version must be 1.1.

  • If you are running antivirus software, you might need to create a rule that allows this MIDlet to allow connections to and from a specific web site. See Section 3.2, "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 is able to obtain. 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. Make sure to end with a slash (/). For example http://www.internetnews.com/. Press the OK soft button. The Http Test screen shows your new URL and prompts for an action.

3.6.2.4 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.

3.6.2.5 Stock

Like the Http demonstration, this sample uses an HTTP connection to obtain information. Use the same preparation steps as Section 3.6.2.3, "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.

Alerts

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 will hear a ring and receive a message. For example, Symbol has reached your price point of $value and is currently trading at $current_value. Once the alert is triggered it disappears from the Current Alerts list.

3.6.2.6 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-separated 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:

installdir\apps\Demos\src\example\auction\NewTicketAuction.java.

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.

3.6.2.7 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.

3.6.2.8 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.

3.6.2.9 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.

3.6.2.10 HttpExample

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

3.6.2.11 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.

3.6.2.12 PushExample

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

3.6.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.6.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. Once 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.6.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 DefaultCldcMsaPhone1 and DefaultCldcMsaPhone2.

3.6.5.1 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. Depending on your security settings, you might see a message explaining that the demo wants to send and receive data over the network and it might ask, "Is it OK to use network?" Choose Yes. The Socket Server displays a status message when the connection is accepted.

  2. In the second emulator, launch the application, select the Client peer, then choose Start. Depending on your security settings, you might see a message explaining that the demo wants to send and receive data over the network and it might ask, "Is it OK to use network?" Choose Yes. Choose Start to launch the client. The Socket Client displays a status message that indicates it is connected to the server. 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.

3.6.5.2 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. Depending on your security settings, you might see a message explaining that the demo wants to send and receive data over the network and it might ask, "Is it OK to use network?" Choose Yes. Initially, the Datagram Server status is Waiting for connection, and the Send box is empty.

  2. In the second emulator, launch Datagram Demo, select the Client peer, then choose Start. Depending on your security settings, you might see a message explaining that the demo wants to send and receive data over the network and it might ask, "Is it OK to use network?" Choose Yes. 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.

  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.

3.6.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.6.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 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.