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 (permalink)  
Old 03-22-2008, 12:19 AM
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
Sponsored Links
  #2 (permalink)  
Old 03-23-2008, 10:32 PM
leoraja8 leoraja8 is offline
D-Web Sr.Programmer
 
Join Date: May 2007
Posts: 194
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 01:56 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-06-2008, 04:08 AM
suman suman is offline
D-Web Trainee
 
Join Date: Aug 2008
Posts: 27
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
__________________
Free templates
web design company
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-30-2008, 04:53 AM
levelup levelup is offline
D-Web Trainee
 
Join Date: Sep 2008
Posts: 18
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.
__________________
business card printing
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash Templates jacksan Flash Actionscript Programming 1 10-20-2008 01:24 AM
Free templates or coding on your own? capture Web Design Help 12 09-26-2008 01:18 AM
Any sites that offer a good free templates? montyauto HTML, CSS and Javascript Coding Techniques 3 08-20-2008 10:15 PM
looking free templates website johnsweet007 Site Management and Marketing 1 08-08-2008 01:50 AM
free templates ? sunder.somil The Lounge 3 10-21-2007 08:32 PM


All times are GMT -7. The time now is 11:18 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0