-
J2ME basic Example
Hi, Can anyone tell me, that how to write a code in j2me? I want to get basics about the java j2me. If you provide some information about this, then it will help me to improve my knowledge. If it is possible to provide some basic information from your knowledge then it will help me a lot. As it is simple to learn from someone than using books. So, please reply me.
-
Re: J2ME basic Example
Hi, I think you will need to know the code below. It is the starting example for each language of programming. So, I am giving you that first. So take a look on it.
Code:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class Hello extends MIDlet
{
private Form frm;
private Display dis;
public Hello()
{
super();
}
public void startApp()
{
frm = new Form("Hello World");
String msg = "Hello World.....";
form.append(msg);
dis = Display.getDisplay(this);
dis.setCurrent(form);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
notifyDestroyed();
}
}
-
Re: J2ME basic Example
Hey, for you to get basic knowledge about the j2me I am giving you code below which will print the hello world, So use to to know more about the j2me. The code below will Print "Hello World" in a Mobile Phone Using J2ME. You can see the output with the help of simulator.
Code:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloWorld extends MIDlet implements CommandListener
{
private Command cmd;
private TextBox t1;
public HelloWorld()
{
cmd = new Command("Exit", Command.EXIT, 1);
t1 = new TextBox("Hello world MIDlet", "Hello World!", 25, 0);
t1.addCommand(exitCommand);
t1.setCommandListener(this);
}
protected void startApp()
{
Display.getDisplay(this).setCurrent(t1);
}
protected void pauseApp() {}
protected void destroyApp(boolean bool)
{
}
public void commandAction(Command cmd1, Displayable disp)
{
if (cmd1 == cmd)
{
destroyApp(false);
notifyDestroyed();
}
}
}
-
Re: J2ME basic Example
Hello, I am also beginner in java. Also wanted to know the java j2me. So, if anyone give me some or the other tricks about the j2me and java, it will be helpful to me. So, please give me some basic code by using of which I can able to get some more information about this. So, if possible give me some programs regarding this. I am waiting for your reply. Your reply will help me to improve my knowledge. So just reply me with some basic concepts.
Page generated in 1,750,885,180.34496 seconds with 10 queries