- Select File->New Project->Mobility->MIDP Application
- Set the project name as MobileConverter and remember to keep Set as main project and Create HelloMIDlet checked
- Select the emulator type, here we’ll tryout the Sun JAVA™ wireless. We’ll be right now programming for a default Color phone with the older CLDC 1.0 config and MIDP-1.0 profile(That’s what my phone supports). Click finish.
- Goto the Screen view and let us now. Click on the text and change its property to Hello, Welcome to Mobile Converter
- Goto Palette and drag and drop a text field item and label it as input.
- Drag an Ok command from the list of Commands and label it as Convert.
- Now goto the flow tab and drop in a new form. Name it as output form.
- Drag a back command and drop it on our new form. Draw connection lines as shown.
- Goto the screen tab, choose the new form and drop in a textfield to show our output.
- Now goto the source code. Write the following method in your MIDlet class.
public void setans()
{
float x=Float.parseFloat(textField.getString());
x+=273.15;
textField1.setString(String.valueOf(x));
textField.setString("0");
}
- Goto screen, in the new form right click and goto source. In the place where you find // write post-init user code here call the setans method by setans();
- You finally have your own mobile app. Click on build and then deploy. Your jar file will be generated in the dist folder. Transfer it to your java enabled phone and enjoy ;)