Home | J2ME Yours page | Favorite Links | Contact Me | objques | Canvas Demo | Fruit selection | Commands | Gauge NI | Gauge Response | Pallet | Pal Ex Mid | Slides Text
Prasad's J2ME programs

About J2ME

Here is a simple program

/* Arithmetc Test*/
import java.lang.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;

public class ArithTest extends MIDlet implements CommandListener{
private Display d;
private Form f;
private Command ce,c1,c2,c3,c4;

private TextField num1,num2,res;
public void startApp(){
d =  Display.getDisplay(this);
f = new Form("Test");
num1 = new TextField("N1","",6,TextField.NUMERIC);
num2 = new TextField("N2","",6,TextField.NUMERIC);
res  = new TextField("R1","",6,TextField.NUMERIC|TextField.UNEDITABLE);
ce = new Command("EXIT",Command.EXIT,1);
c1 = new Command("ADD",Command.ITEM,1);
c2 = new Command("SUB",Command.ITEM,1);
c3 = new Command("MUL",Command.ITEM,1);
c4 = new Command("DIV",Command.ITEM,1);
f.append("Helllo how are you");
f.append(num1);
f.append(num2);
f.append(res);
f.addCommand(c4);
f.addCommand(c1);
f.addCommand(c2);
f.addCommand(c3);
f.addCommand(ce);
f.setCommandListener(this);
d.setCurrent(f);
}
public void pauseApp(){}
public void destroyApp(boolean unconditional){}

public void commandAction(Command c,Displayable s){
int n1,n2,r1;
if( c == ce)
notifyDestroyed(); 
else if(c == c1){
n1 = Integer.parseInt(num1.getString());
n2 = Integer.parseInt(num2.getString());
r1 = n1+n2;
res.setString(""+r1);
}
else if(c == c2){
n1 = Integer.parseInt(num1.getString());
n2 = Integer.parseInt(num2.getString());
r1 = n1-n2;
res.setString(""+r1);
}
else if(c == c3){
n1 = Integer.parseInt(num1.getString());
n2 = Integer.parseInt(num2.getString());
r1 = n1*n2;
res.setString(""+r1);
}
else if (c == c4){
n1 = Integer.parseInt(num1.getString());
n2 = Integer.parseInt(num2.getString());
r1 = n1/n2;
res.setString(""+r1);
}
}
}

I might also include some information about my personal history: where I grew up, where I went to school, various places I've lived. If I have one, I'll include a picture of myself engaging in an activity I enjoy, such as a sport or hobby.

Backpacker taking a drink; Size=180 pixels wide
Taking a break from work

What a job!

I might describe my job in a little more detail here. I'll write about what I do, what I like best about it, and even some of the frustrations. (A job with frustrations? Hard to believe, huh?)

Favorites

Here's a list of some of my favorite movies:

Jules and Jim, Manhattan, Breaking the Waves

Here's a list of some of my favorite music:

Nirvana, Frank Sinatra, Ibrahim Ferrer


"Striving for success without hard work is like trying to harvest where you haven't planted."