Details of the MIDlet Composer
When the first MIDlet of a session is opened in the IDE, three new windows appear on the screen. They are the MIDlet Composer, the MID Emulator, and the Mobile Devices Palette. The MID Emulator and Palette are covered in other chapters.
The Composer is a dynamic, context-sensitive area in which the user can assign default properties and behaviors for all parts in a program. All user supplied code that a program requires is entered into the composer, including event response code, class declaration and constructor code, and method code which can be called from within the MIDlet or from external code which will use the MIDlet.
Parts of a MIDlet Composer.
![]()
The MIDlet Composer has five parts.
The Parts tree shows the structure of the currently open MIDlets in a tree view. Parts may be dragged from one part of the tree to another, including the recycling bin. Parts may also be dragged from the Palette to appropriate parts of the tree. The Parts tree will not allow all parts to be moved; parts which represent fundamental aspects of a MIDlet cannot be moved. Likewise, parts which can be moved may only be moved to appropriate locations. The tree will display a cancel icon if the part may not be moved to a location. The nodes of the tree may be collapsed or expanded to aid in navigation. The amount of space devoted to the tree may adjusted by dragging the separator bar.
Parts are selected by clicking on them in the Parts tree. When a part is selected in the Parts tree, it is highlighted in the tree. In addition, the name of the part is shown in the title area, the contextual help for that part is displayed, and the property sheet for the part is displayed.
There are two special nodes which are always in the Parts tree: The MIDlet Suite and the Recycling Bin. The MIDlet Suite is the top node for all MIDlets. It does not have any properties which can be modified. The Recycling Bin is where parts may be dragged which will be destroyed. It can also be used as a temporary holding place to store parts apart from their MIDlet. Parts in the Recycling Bin should not be edited.
The contextual help area is a scrollable area which displays help about the part which is currently selected in the Parts tree.
The Property sheet for a part is displayed in the lower portion of the composer window. The property sheet is also part-specific. The initial properties of a part can be set in the Property sheet. Some properties may be changed in the Emulator by either event code or by user interaction with the Emulator. The user may restore all parts to the state specified in the properties pages by choosing the Reload MIDlet menu item on the MIDlet menu.
![]()
Property sheets may consist of code areas. The user can enter any legal Java statements in these code areas. Simplicity watches for any changes made and updates the Emulator so that the Emulator always reflects the current state of the code. If an import statement is entered in a code event area, it will be moved to the proper place in the generated code.
At the top of every code area is a Code Sourcerer button. The Code Sourcerer will write Java statements for the user based upon the user's choices. Some code pages will generate code inside a method statement. For example, the destroyApp code area will allow users to write code inside the destroyApp method. This method has a local variable, 'unconditional', available to it. The Sourcerer's Apprentice is also available in code areas.
| Data Representations, Inc. http://www.datarepresentations.com support@datarepresentations.com sales@datarepresentations.com |