C H A P T E R 6 |
The Currency Converter Networked Mobile Data Application |
Now that you have seen how to build the Currency Converter MIDlet, this chapter will show you a modified version of the same application. In this client/server version of the Currency Converter, the application can call the server to check the current rates of exchange before completing currency conversion calculations.
This chapter will guide you through installing and running the Currency Converter Wireless application. The next chapter will show you how to construct both client and server parts of the application, and how to connect them using the J2ME Wireless Connection Wizard.
This chapter is organized under the following topics:
The following files comprise the client MIDlet Suite, converter_networked:
The server side of the application includes the following files:
The Java Studio Mobility provides an Examples Setup wizard that installs the complete example in the IDE.
Note - As with all future instructions, it is assumed the Java Studio Mobility IDE is up and running on your desktop. |
To install the Currency Converter:
1. Choose Help Examples Setup Wizard.
The Examples Setup wizard opens.
2. On the Examples Setup page, check the Currency Converter Wireless Connection Example box. Click Next.
The installation page opens, with a progress bar that indicates when the example is installed.
3. Click Finish to close the Example Setup wizard.
The Currency Converter Wireless Connection example is installed and mounted in the default examples filesystem. You can see the directory in the Filesystems window.
Now that you have installed the application, the next section shows you how to compile and run the application in a device emulator.
1. In the Filesystems window, expand the Currency Converter Wireless Connection Example: /client filesystem node.
A Converter folder and Converter_networked suite node display.
2. Right-click on the MIDlet suite and choose Execute.
The Execute function compiles the MIDlet application, if necessary, before it executes the application.
As with the first Currency Converter application, the MIDlet suite runs on the default DefaultColorPhone skin within the J2ME Wireless Toolkit 2.1 installation.
Now you're ready to test the application in the device emulator.
3. Select the currency you want to convert by clicking the up and down arrow keys on the Select button.
You can select Dollars, Euros, or Yen.
4. Enter the currency amount to convert by clicking the emulator's numeric keys.
The application makes the conversion calculations and displays the results.
5. Click the button underneath the word "Exit" to exit the application.
6. Click the red button in the upper right corner to close the emulator.
In this chapter, you went through the few steps it takes to compile and run a simple MIDlet in an emulator device.
In the next chapter, you will learn how to modify the Currency Converter application so that it runs as a client/server application on a network.
Copyright © 2004, Sun Microsystems, Inc. All rights reserved.