IT Community - Software Programming, Web Development and Technical Support

Templates for Input/Output in J2ME?

This is a discussion on Templates for Input/Output in J2ME? within the J2ME forums, part of the Mobile Software Development category; Hi, J2ME newbie here. I would like to know if there are templates or sample codes for accepting user input ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > Mobile Software Development > J2ME

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 03-21-2008, 11:19 PM
dchips13 dchips13 is offline
D-Web Trainee
 
Join Date: Mar 2008
Posts: 3
dchips13 is on a distinguished road
Default Templates for Input/Output in J2ME?

Hi, J2ME newbie here. I would like to know if there are templates or sample codes for accepting user input values and displaying output values as well. I am currently working on an IP Subnetting Calculator and managed to implement it on jdk (I am knowledgeable enough in Java jdk). My program accepts input (to be used as int) and uses the said values in formulas to compute for output to be displayed. The challenge is to be able to implement it in J2ME.

Any help would be greatly appreciated, thanks and more power to the community
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 03-23-2008, 09:32 PM
leoraja8 leoraja8 is offline
D-Web Sr.Programmer
 
Join Date: May 2007
Posts: 188
leoraja8 is on a distinguished road
Default Re: Templates for Input/Output in J2ME?

hi dchip13,

below code helps you to pass input and the value you passed is multiplied by 2(modify required calculation as you need) and get desired output ...i here developed this code using simple form...for graphical user interfaces you can develop it through canvas class.....

Code:
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;


public class IOTemp extends Form implements CommandListener
{
    TextField txtInput;
    Command cmdOutput;
    /** Creates a new instance of IOTemp */
    public IOTemp()
    {
        super("IOSample");
        txtInput = new TextField("Input :", "", 10, TextField.ANY);/* passing input value  */ 
        append(txtInput);
        cmdOutput = new Command("Add", Command.OK, 0);/* display required output value */
        setCommandListener(this);
        addCommand(cmdOutput);
    }

    public void commandAction(Command command, Displayable displayable)
    {
        try
        {
            int input = Integer.parseInt(txtInput.getString());
            append("\nOutput :" + add(input));
        }
        catch (NumberFormatException e)
        {
            
        }
    }
    
    public int add(int input)  // calculation method
    {
        return input + input;
    }
    
}

Last edited by leoraja8 : 03-24-2008 at 12:56 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 08-06-2008, 03:08 AM
suman suman is offline
D-Web Trainee
 
Join Date: Aug 2008
Posts: 19
suman is on a distinguished road
Default Re: Templates for Input/Output in J2ME?

Hi this is shaggy here


click on the following link for free templates.

thanks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 09-30-2008, 03:53 AM
levelup levelup is offline
D-Web Trainee
 
Join Date: Sep 2008
Posts: 16
levelup is on a distinguished road
Default Re: Templates for Input/Output in J2ME?

is really useful for me, I am glad to read it here.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Templates For Ur Benefit Paul Adams Site Management and Marketing 3 07-15-2010 08:29 AM
C++ Input/Output with files smith21 C and C++ Programming 1 12-22-2008 07:26 PM
Free templates or coding on your own? capture Web Design Help 11 09-26-2008 12:18 AM
free templates ? sunder.somil The Lounge 3 10-21-2007 07:32 PM


All times are GMT -7. The time now is 12:34 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
Stamford Dentist | Euro Millions Lottery | Tech Support Services

SEO by vBSEO 3.0.0