Atutility Universal Converter Development Notes

bravesnailsΛογισμικό & κατασκευή λογ/κού

7 Ιουν 2012 (πριν από 5 χρόνια και 17 μέρες)

478 εμφανίσεις

Atutility Universal Converter Development Notes
J2ME Edition Using NetBeans 5.5
Version
Date
Author
Notes
0.1
2007-07-13
Huang Kai
Initial version
I.
About J2ME
Java 2 Mobile Edition is the Java Platform for mobile phones, PDA and other smaller devices.
II.
About NetBeans
NetBeans is the best Java IDE in my opinion, I begin to use it since 1998 and still using. You

can learn more about NetBeans from
http://www.netbeans.org
III.
Development environment
1.
OS: Microsoft Windows Vista Home Basic
2.
JDK 6u1: 1.6.0_01
3.
NetBeans 5.5
4.
NetBeans Mobility 5.5
II.
Prerequisites
1.
Familiar with Java and J2ME
2.
Download and install JDK, NetBeans IDE, NetBeans Mobility
III.
Create the project
1.
Start NetBeans IDE, create a new project, in Mobile category, select Mobile Application
2.
Project name: nbjme, set as main project, don't create Hello MIDlet
3.
Select the platform: CLDC-1.1, MIDP-2.0, then Finish the wizard
4.
Right click the project, select New->Visual MIDlet
5.
The MIDlet settings
IV.
Design the user interface
1.
Create 3 List screen, 1 Form screen
1.
lstType: title=Select Type
2.
lstUnit1: title=Source Unit
3.
lstUnit2: title=Target Unit
4.
frmCalc: title=Calculation
2.
Add OK and Exit command for lstType
3.
Add OK and Back command for lstUnit1, lstUnit2, frmCalc
4.
Connect those commands
5.
Right click on project, select Properties
1.
in Attributes, change the MIDlet-Name, Vendor and Version information
2.
in MIDlets, change the Name
6.
Execute the project
V.
Prepare the data archticure
1.
Type: the class for conversion type, it has name field and vector field which contains all

units in this type
2.
Unit: the class for conversion unit, it has name and factor field
3.
Temperature: the class for temperature, it extends Unit and has a increment field
VI.
init function
1.
create the types, units and add units to types
VII.
Design and coding for lstType
1.
Switch to lstType in “Screen Design” mode
2.
rename the command to cmdSelectType and cmdExit
3.
right click on “Device Screen”, select “Go to Source”
4.
in the “post-init” code section, append all types into the lstType
5.
right click on cmdSelectType, select “Go to Source”
6.
in the “post-action” code section, clear all items in lstUnit1, and append all Units to it
VIII.
Design and coding for lstUnit1
1.
Switch to lstUnit1 in “Screen Design” mode
2.
rename the command to cmdUnit1 and leave the back command alone
3.
right click on cmdUnit1, select “Go to Source”
4.
in the post-action code section, clear all items in lstUnit2, and append all Units to it
IX.
Design frmCalc
1.
Switch to frmCalc in “Screen Design” mode
2.
rename the command to cmdCalc and leave the back command alone
3.
Add 3 StringItem, 1 TextField, 1 StringItem
1.
strType: label=Conversion Type
2.
strUnit1: lable= Source Unit
3.
strUnit2: lable= Target Unit
4.
txtInput: lable=Input, Constraints=Decimal
5.
strResult: label=Result
X.
Design and coding for lstUnit2
1.
Switch to lstUnit2 in “Screen Design” mode
2.
rename the command to cmdUnit2 and leave the back command alone
3.
right click on cmdUnit2, select “Go to Source”
4.
in the post-action code section, update the text of strType, strUnit1, strUnit2
XI.
Coding for frmCalc
1.
right click on cmdCalc, select “Go to Source”
2.
calculate the result
3.
Execute the project: WTK 2.2 and WTK 2.5.1
XII.
Deploy the project
1.
Right click on project, select “Deploy Project”
2.
NetBeans generated the jar file in dist folder
XIII.
Plan for next version
1.
Waiting for comments