Create a new Application
You will now create a new MIDlet (which will become your tip calculator). In the IDE, you see on the left the Project Tree, which has three sections. The first is called "Project Groups", and contains a list of group names. Each of these items represents a group of files which will appear in the box on the right when selected.
- Choose the first item in Project Groups, labeled 'Composer Files'.
- To see what this tutorial will look like when finished, double click on Finished.Midlet.
Three windows appear. One of these will contain a picture of a Palm OS Platform based handheld computer. Running in it will be the simple tip calculator. It will have two spaces where you can enter text, labeled 'Bill Amount $:' and 'Percentage:'. It will also have a button labeled 'compute tip'. Click to the right of 'Bill Amount $:' so that the cursor appears. You can then type a number into the TextField. Click on 'Percentage' and type another number. Finally, press the 'compute tip' button at the bottom of the screen to see the amount of the tip.- When you are finished, choose Exit from the File menu of the first window, titled 'Simplicity Composer'. Press None when asked if you would like to save any changes.
- In the IDE, choose 'Midlet' from the Create menu. This creates a new MIDlet in the current project. (You can also press the 'Create a MIDlet' button on the button bar. It is the fourth button from the left in the IDE.)
A new Icon appears in the 'Composer Files' group with a name similar to Untitled0.Midlet.- Click this new icon once to select it. (It will become highlighted.)
- From the Edit menu, choose Rename selection. A text field will appear to the right of the icon. Replace the old name with 'tip calculator'. Click the mouse anywhere else in the right hand window to accept the change. If you don't specify the '.Midlet' extension, Simplicity will add it for you. Simplicity will also modify the spacing and capitalization to conform to Java naming conventions.
- Double click the new 'TipCalculator.Midlet' icon to open the Simplicity Composer.
You have now created a new MIDlet, and have loaded it into the Simplicity Composer. You should see three new Windows on the screen. They are the Composer window, the Mobile Devices Palette, and a window titled MID Emulator which contains a picture of a Palm OS Platform based handheld computer. This last window is the Emulator.
The composer window is the place where you will set up all of the properties of the graphical parts of your program. It is also where you will be able to supply all the code that your program will need.
The left-hand side of the Composer window is a tree showing the different parts of all MIDlets currently open. This is called the Parts tree. This area will be where you will drag new parts of your MIDlets, and where you can rearrange the order of the parts of your MIDlet. It also provides a quick way to switch from one part to another in your MIDlet. The different nodes on the tree may be expanded or collapsed to show the parts of the MIDlet which you are currently working on.
The right side of the Composer window is the title, contextual help, and Property sheet for the selected part. The Property sheet will be used to change the initial settings of the parts in your MIDlet.
| Data Representations, Inc. http://www.datarepresentations.com support@datarepresentations.com sales@datarepresentations.com |