Magazine
 
Java ME
 
program like “RoseindiaMIDlet.java” and save it in the location

“C:\WTK2.5.1\apps\Roseindia\src\”.
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class RoseindiaMIDlet extends MIDlet
implements CommandListener {
public void startApp() {
Display display = Display.getDisplay(this);
Form mainForm = new
Form(“RoseindiaMIDlet”);
mainForm.append(“Welcome to
www.Roseindia.net”);
Command exitCommand = new
Command(“Exit”, Command.EXIT, 0);
mainForm.addCommand(exitCommand);
mainForm.setCommandListener(this);
display.setCurrent(mainForm);
}
public void pauseApp()
{
}
public void destroyApp(boolean
unconditional) {}
public void commandAction(Command c,
Displayable s)
{
if (c.getCommandType() == Command.EXIT)
notifyDestroyed();
}
}

Step 6: Next click the “Build” button from the



toolkit menu bar. This causes the Sun Java Wireless Toolkit for CLDC to compile and preverify the Java source files. The whole build process is shown below.

 

Step 7: Next click the “Run” button from the toolkit menu bar. This executes the compiled Java class files on the emulator.

Step 8: Execution of the compiled Java class

Oct 2007 | Java Jazz Up | 20
 
previous
index
next
 
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70, 71, 72, 73, 74, 75, 76, 77, 78,   Download PDF