Showing posts with label Mobile Communication. Show all posts
Showing posts with label Mobile Communication. Show all posts

Monday, 23 January 2012


To Develop a Simple M-Commerce Application

Code:
/*To Develop a Simple M-Commerce Application*/
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import java.util.*;

public class Practical10 extends MIDlet implements CommandListener
{
Form frm1;
Form frm2;
Form frm3;
Form frm4;
Form frm5;
Form frm6;
Form frm7;

TextField tfUName;
TextField tfPswd;
TextField Amount;

String s1, s2, s3;
ChoiceGroup cgAccount;
ChoiceGroup cgTrans;

Command cmdOk; //frm1
Command cmdExit1;//frm1
Command cmdSignIn;//frm2
Command cmdBack;//frm2
Command cmdNextTR;//frm3
Command cmdBackLG;//frm3
Command cmdBackAC;//frm4
Command cmdPAmount;//frm4
Command cmdBackTR;//frm5
Command cmdNote;//frm5
Command cmdExit2;//page7
Command cmdExit3;//page6
Command cmdExit4;//page7
Command cmdExit5;//page6


private Display display;
private Ticker ticker;

public Practical10()
  {
try
{
  frm1 = new Form("Welcome");
frm2 = new Form("Login");
frm3 = new Form("Account Type");
frm4 = new Form("Transaction Page");
frm5 = new Form("Amount Page");
frm6 = new Form("Balance");
frm7 = new Form("Receipt");


ticker = new Ticker ("WELCOME TO THE ATM,PRESS NEXT TO ENTER");
display = Display.getDisplay(this);

cmdOk=new Command("NEXT",Command.SCREEN,1);//frm1
  cmdExit1=new Command("EXIT",Command.EXIT,0);//frm1
tfUName=new TextField("Enter User Name : ","",30,TextField.ANY);
tfPswd=new TextField("Enter Password : ","",30,TextField.ANY);
cmdBack=new Command("BACK",Command.BACK,0);//frm2
cmdSignIn=new Command("SignIn",Command.SCREEN,1);//frm2

cgAccount=new ChoiceGroup("Type of Account : ",Choice.EXCLUSIVE);
cgAccount.append("Saving a/c",null);
cgAccount.append("Current a/c",null);
cmdBackLG=new Command("BACK",Command.BACK,0);//frm3
cmdNextTR=new Command("NEXT",Command.SCREEN,1);//frm3

cgTrans=new ChoiceGroup("Type of Transaction : ",Choice.EXCLUSIVE);
cgTrans.append("Withdrawal ",null);
cgTrans.append("Balance",null);
cmdBackAC=new Command("BACK",Command.BACK,0);//frm4
cmdPAmount=new Command("NEXT",Command.SCREEN,1);//frm4

Amount=new TextField("Enter Amount to withdraw : ","",10,TextField.ANY);
cmdBackTR=new Command("BACK",Command.BACK,0);//frm5
cmdNote=new Command("Next",Command.SCREEN,1);//frm5

cmdExit2=new Command("BACK",Command.BACK,0);//page7
cmdExit3=new Command("BACK",Command.BACK,0);//page6

cmdExit4=new Command("EXIT",Command.BACK,0);//page7
cmdExit5=new Command("EXIT",Command.BACK,0);//page6

}
catch(Exception e)
{
System.out.println (e);
}
  }

  public void startApp()
  {
frm1.addCommand(cmdOk);
frm1.addCommand(cmdExit1);
try
{
Image im = Image.createImage("/images.jpg");
        frm1.append(new ImageItem(null, im, ImageItem.LAYOUT_CENTER , null));
frm1.setTicker(ticker);
display.setCurrent(frm1);
}
catch (java.io.IOException e)
{
System.err.println("Unable to locate or read .jpg file");
}
frm1.setCommandListener(this);

frm2.addCommand(cmdBack);
frm2.addCommand(cmdSignIn);
frm2.append(tfUName);
frm2.append(tfPswd);
display=Display.getDisplay(this);
frm2.setCommandListener(this);

String msg = "PLEASE SELECT AN ACCOUNT TYPE FOR TRANSACTION";
frm3.append(msg);
frm3.append(cgAccount);
frm3.addCommand(cmdBackLG);
frm3.addCommand(cmdNextTR);
frm3.setCommandListener(this);
display=Display.getDisplay(this);

frm4.append(cgTrans);
frm4.addCommand(cmdBackAC);
frm4.addCommand(cmdPAmount);
frm4.setCommandListener(this);
display=Display.getDisplay(this);

frm5.addCommand(cmdBackTR);
frm5.addCommand(cmdNote);
frm5.append(Amount);
display=Display.getDisplay(this);
frm5.setCommandListener(this);

frm7.addCommand(cmdExit2);
frm7.addCommand(cmdExit4);
display=Display.getDisplay(this);
frm7.setCommandListener(this);

frm6.addCommand(cmdExit3);
frm6.addCommand(cmdExit5);
display=Display.getDisplay(this);
frm6.setCommandListener(this);

}

  public void pauseApp(){}

  public void destroyApp(boolean unconditional)
  {
    notifyDestroyed();
  }

  public void commandAction(Command c,Displayable d)
  {

 try
 {
 if(c==cmdExit1)
 {
 destroyApp(false);
 notifyDestroyed();
 }
 if(c==cmdOk)
 {
 display.setCurrent(frm2);
 }
 if(c==cmdSignIn)
 {
 s2 = tfUName.getString();
 s3 = tfPswd.getString();
 if((s2.equals("scott"))&&(s3.equals("tiger")))
 {
 display.setCurrent(frm3);
 }
 }
 if(c==cmdBack)
 {
 display.setCurrent(frm1);
 }
 if(c==cmdBackLG)
 {
 display.setCurrent(frm2);
 }
 if(c==cmdNextTR)
 {
 display.setCurrent(frm4);
 }

 if(c==cmdBackAC)
 {
 display.setCurrent(frm3);
 }
 if(c==cmdNote)
 {
 s1 = Amount.getString();
 int s4 = Integer.parseInt(s1);
 if(s4>1000)
 {
 Alert bal1 = new Alert("Transaction not allowed","Minimum balance required:500", null, AlertType.INFO);
 bal1.setTimeout(5000);
 display.setCurrent(bal1,frm7);
 }
 else
 {
 frm7.append("You have withdrawn Rs: " + s1 + "from your account");
 display.setCurrent(frm7);
 }
 }

 if(c==cmdPAmount)
 {
 boolean choice1;
 choice1 = cgTrans.isSelected(0);
/* boolean choice2;
 choice2 = cgTrans.isSelected(1); */

 if(choice1 == true)
 {
display.setCurrent(frm5);
 }
 else
 //if(choice2 == true)
 {
 int savBal = 1500;
 int curBalance = 1500;

 int s4 = Integer.parseInt(s1);
 boolean accType1;
 accType1 = cgAccount.isSelected(0);
 if(accType1 == true)
 {
 savBal=savBal-s4;
 }

 boolean accType2;
 accType2 = cgAccount.isSelected(1);
 if(accType2 == true)
 {
 curBalance=curBalance-s4;
 }
 String msg1 = "saving account: "+savBal+"\n current acount: "+curBalance;
 frm6.append(msg1);
 display.setCurrent(frm6);
 }
 }

 if(c==cmdBackTR)
 {
 display.setCurrent(frm4);
 }

 if(c==cmdExit2)
 {
 display.setCurrent(frm4);
 }

 if(c==cmdExit3)
 {
 display.setCurrent(frm4);
 }

 if(c==cmdExit4)
 {
 destroyApp(false);
 notifyDestroyed();
 }

 if(c==cmdExit5)
 {
 destroyApp(false);
 notifyDestroyed();
 }
 }
 catch(Exception e)
  {
 System.out.println("Error!!!!!!!!");
  }

  }

}

Sample Outputs:
Hope you like the post, comment bellow for Query and Feedback :)

Prof.Mahendra Kanojia


Program Study of WML Events, Tasks, Input and Variable Elements

Code:
/*Program Study of WML Events, Tasks, Input and Variable Elements*/
<?xml version = "1.0"?>
<!DOCTYPE wml PUBLIC "-//OPENWAVE.COM//DTD WML 1.3//EN"
"http://www.openwave.com/dtd/wml13.dtd" >
<wml>
<card id = "stock">
<do type="accept" label="Next">
<spawn href="#order">
<catch>
<receive name="status" />
</catch>
<receive name="status"/>
</spawn>
</do>
<p>
Stock Trade Example<br />
$(status)
</p>
</card>
<card id = "order">
<do type ="accept" label="Order">
<spawn href="#confirm" onexit="?">
<receive name="status" />
</spawn>
</do>
<do type ="options" label="Prev">
<exit>
<send value="Status: No trade"/>
</exit>
</do>
<p>
Stock Order: <br />
Stock&nbsp; : PHCM <br />
Shares : 100 <br />
</p>
</card>
<card id="confirm">
<do type="accept" label="Yes">
<exit>
<send value="Status: Completed"/>
</exit>
</do>
<do type="options" label="Cancel">
 <throw name="onerror">
 <send value="Status: Cancelled" />
 </throw>
</do>
<p align="center">
<b> *** Confirm***<br />
Stock Order <br />
</b>
</p>
</card>
</wml>

Sample Output:

Comment bellow for Query and Feedback :)

Prof.Mahendra Kanojia


WML Program to Display Image

Code:
/*WML Program to Display Image*/
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORAM//DTD WML 1.2//EN"
"http:??www.wapforum.org/DTD/wml12.dtd">
<wml>
<card title = "Image">
<p>
This is an Image
<img src="info.wbmp" alt="info"?>
</p>
</card>
</wml>

Sample Output:

Comment bellow for Query and Feedback :)

Prof.Mahendra Kanojia


WML Program to Display Input-Output

Code:
/*WML Program to Display Input-Output*/
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORAM//DTD WML 1.2//EN"
"http:??www.wapforum.org/DTD/wml12.dtd">

<wml>
<card id="Login" title="Login">
<do type="accept" label="Results">
<go href="#Results"/>
</do>
<p>
UserName:
<select name="name" title="Name:">
<option value="madhavi">madhavi</option>
<option value="shweta">shweta</option>
</select>
Password:
<select name="pass" title="Password:">
<option value="password1">password1</option>
<option value="password2">password2</option>
</select>
</p>
</card>
<card id="Results" title="Results:">
<p>
You Entered:<br />
Name:$(name)<br />
password:$(pass)<br />
</p>
</card>
</wml>

Sample Output:

Comment bellow for Query and Feedback :)

Prof.Mahendra Kanojia


WML Program to Display option group

Code:
/*WML Program to Display option group*/
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORAM//DTD WML 1.2//EN"
"http:??www.wapforum.org/DTD/wml12.dtd">
<wml>
<card title="Selectable list">
<p>
<select>
<optgroup title = "INDIA">
<option value="DELHI">DELHI</option>
<option value="MUMBAI">MUMBAI</option>
<option value="HYDERABAD">HYDERABAD</option>
</optgroup>
<optgroup title = "USA">
<option value="LA">LA</option>
<option value="NEW YORK">NEW YORK</option>
<option value="LONDON">LONDON</option>
</optgroup>
</select>
</p>
</card>
</wml>

Sample Output:

Comment bellow for Query and Feedback :)

Prof.Mahendra Kanojia


WML Program to Display Timer

Code:
/*WML Program to Display Timer*/
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORAM//DTD WML 1.2//EN"
"http:??www.wapforum.org/DTD/wml12.dtd">
<wml>
<card id="splash" title="splash">
<onevent type="ontimer">
<go href="#Welcome">
</onevent>
<timer value=50"/>
<p>
<a href="#Welcome">Enter</a>
</p>
</card>
<card id="Welcome" title="Welcome">
<p>
Welcome to the main screen
</p>
</card>
</wml>

Sample Output

Comment bellow for Query and Feedback :)
Prof.Mahendra Kanojia

WML Program to Display Table

Code:
/*WML Program to Display Table*/
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORAM//DTD WML 1.2//EN"
"http:??www.wapforum.org/DTD/wml12.dtd">
<wml>
<card title = "WML Table">
<p>
<table columns="3" align="LCR" Border="1">
<tr>
<td>col1</td>
<td>col2</td>
<td>col3</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>D</td>
<td>E</td>
<td>F</td>
</tr>
</table>
</p>
</card>
<wml>

Sample Output:

Comment bellow for Query and Feedback :)
Prof.Mahendra Kanojia

WML Program to Display Template

Code:
/*WML Program to Display Template*/
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORAM//DTD WML 1.2//EN"
"http:??www.wapforum.org/DTD/wml12.dtd">
<wml>
<template>
<do name="main_menu" type="accept" label="chapters">
<go href="#chapters"/>
</do>
<do name="menu_1" type="accept" label="chapter1">
<go href="#chapter1"/>
</do>
<do name="menu_2" type="accept" label="chapter2">
 <go href="#chapter2"/>
</do>
<card id="chapters" title="WML Tutorial"?
<p>
select one chapter:<br />
         <anchor>
<go href="#chapter1"/>
chapter1: WML Overview
       </anchor><br />
<anchor>
<go href="#chapter2"/>
chapter2: WML Environment
</anchor><br />
</p>
</card>
<card id="chapter1" title="WML Tutorial ch1">
<p>
<em>Chapter 1: WML Introduction</em><br />
</p>
</card>
<card id="chapter2" title="WML Environment ch2">
<p>
<em>Chapter 2: WML Environment</em><br />
</p>
</card>
</wml>

Sample Output

Comment bellow for Query and Feedback :)

Prof.Mahendra Kanojia


WML Program for Displaying Different Types of Text

Code:
/*WML Program for Displaying Different Types of Text*/
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORAM//DTD WML 1.2//EN"
"http:??www.wapforum.org/DTD/wml12.dtd">
<wml>
<card title="Text Formatting">
<p>
<b>bold Text</b><br />
<big>big Text</big><br />
<em>Emphasized Text</em><br />
                  <i>italic Text</i><br />
<small>small Text</small><br />
<strong>strong Text</Strong><br />
<u>underlined Text</u>
          </p>
</card>
</wml>

Sample Output:

Comment bellow for Query and Feedback :)

Prof.Mahendra Kanojia

Sunday, 22 January 2012


J2ME Program to Record Data and Print it to the Console

Code:
/*J2ME Program to Record Data and Print it to the Console*/
import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;

public class RecordStoreMIDlet extends MIDlet implements CommandListener
{
  private Display display;
  private Alert alert;
  private Form form;
  private Command exit, start, close;
  private RecordStore r_store;
  private Image image;
  public void startApp()
{
    try{image = Image.createImage("/error.png");}catch(Exception e){}
    display = Display.getDisplay(this);
    start = new Command("Start", Command.SCREEN, 1);
    close = new Command("Close", Command.SCREEN, 1);
    exit = new Command("Exit", Command.SCREEN, 1);
    form = new Form("Record Store");
    form.addCommand(start);
    form.addCommand(close);
    form.addCommand(exit);
    form.setCommandListener(this);
    display.setCurrent(form);
  }
  public void pauseApp(){}
  public void destroyApp(boolean unconditional){
    notifyDestroyed();
  }
  public void commandAction(Command c, Displayable displayable){
    String label = c.getLabel();
    if(label.equals("Start")){
      try
{
        r_store = RecordStore.openRecordStore("Sandeep Kumar Suman", true );
        String name = r_store.getName();
        System.out.println("Name: "+name);
      }
catch (Exception error)
{
        alert = new Alert("Exception", error.toString(), image,
        AlertType.WARNING);
        alert.setTimeout(Alert.FOREVER);
        display.setCurrent(alert);
      }          
    }
else if(label.equals("Close"))
{
      Try
      {
       r_store.closeRecordStore();
        System.out.println("Successfully Closed Record");
      }
catch (Exception error)
{
        alert = new Alert("Exception", error.toString(), image,
        AlertType.WARNING);
        alert.setTimeout(Alert.FOREVER);
        display.setCurrent(alert);
 }
    }
else if (RecordStore.listRecordStores() != null)
{
      Try
    {
        RecordStore.deleteRecordStore("Sandeep Kumar Suman");
        System.out.println("Successfully Deleted The Record");
      }
catch (Exception error)
{
        alert = new Alert("Exception", error.toString(), image,
        AlertType.WARNING);
        alert.setTimeout(Alert.FOREVER);
        display.setCurrent(alert);
      }
    }
else if(label.equals("Exit"))
   {
      destroyApp(true);
    }
  }  
 }

Sample Output






Comment bellow for Query and Feedback :)
Prof.Mahendra Kanojia

J2ME Program to Read the Contents of a File

Code:
/*J2ME Program to Read the Contents of a File*/
import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class ReadFile extends MIDlet implements CommandListener
{
  private Display display;
  private Form form;
  private Command read, exit;
  private Alert alert;
  public ReadFile()
  {
    display = Display.getDisplay(this);
    read = new Command("Read", Command.SCREEN, 1);
    exit = new Command("Exit", Command.EXIT, 1);  
    form = new Form("Read File");
    form.addCommand(exit);
    form.addCommand(read);
    form.setCommandListener(this);
  }

  public void startApp()
  {
    display.setCurrent(form);
  }
  public void pauseApp()
 {}
  public void destroyApp(boolean unconditional)
  {
    notifyDestroyed();
  }
  public void commandAction(Command c, Displayable s)
{
    String label = c.getLabel();
    if (label.equals("Read")){
      String string = file();
      if (string != null)
{
        alert = new Alert("Reading", string, null, null);
        alert.setTimeout(Alert.FOREVER);
        display.setCurrent(alert, form);
      }
    } else if (label.equals("Exit")){
      destroyApp(false);
    }
  }
  private String file()
{
    InputStream is = getClass().getResourceAsStream("help.txt");
    StringBuffer sb = new StringBuffer();
    try{
      int chars, i = 0;
      while ((chars = is.read()) != -1){
        sb.append((char) chars);
      }
      return sb.toString();
    }
catch (Exception e)
 {}
    return null;
}
}

Sample Output

Comment bellow for Query and Feedback :)
Prof.Mahendra Kanojia

J2ME Program to Access Data from a Specific URL. The stream connection is used to connect the application to specific URL by Airtime.

Code:
/*J2ME Program to Access Data from a Specific URL*/

import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class AccessUrl extends MIDlet
{
  private Display display;
  String url = "http://localhost/AccessURL/hello.txt";
  public AccessUrl()
  {
    display = Display.getDisplay(this);
  }
  public void startApp()
{
    Try
{
      connection(url);
    }
catch (IOException e)
{
      System.out.println("IOException " + e);
      e.printStackTrace();
    }
  }

  public void pauseApp(){}
  public void destroyApp(boolean unconditional){}
  void connection(String url) throws IOException
{
    StreamConnection sc = null;
    InputStream is = null;
    StringBuffer buffer = new StringBuffer();
    TextBox access;
    Try
{
      sc = (StreamConnection)Connector.open(url);
      is = sc.openInputStream();
      int chars;
      while((chars = is.read()) != -1)
{
        buffer.append((char) chars);
      }
      System.out.println(buffer.toString());
      access = new TextBox("Access Text", buffer.toString(), 1024, 0);
    }
Finally
{
      if(is != null)
      {
        is.close();
      }
      if(sc != null)
       {
        sc.close();
      }
    }
    display.setCurrent(access);
  }
}

Sample Output:

Comment bellow for Query and Feedback :)
Prof.Mahendra Kanojia

J2ME Program to Continuously Scroll a Data Message on the Mobile Screen

Code:
/*J2ME Program to Continuously Scroll a Data Message on the Mobile Screen*/

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class TickerExample extends MIDlet implements CommandListener{
  private Display display;
  private Ticker ticker;
  private Command exit;
  private Form form;
    public TickerExample()
{
    form = new Form("Ticker Example");
    display = Display.getDisplay(this);
    ticker = new Ticker ("This is an Ticker Example");
    exit = new Command("Exit", Command.SCREEN, 1);
    form.addCommand(exit);
    form.setCommandListener(this);
    form.setTicker(ticker);
  }
  public void startApp()
  {
    display.setCurrent(form);
  }
  public void pauseApp(){ }
  public void destroyApp(boolean unconditional)
  {
    notifyDestroyed();
  }
  public void commandAction(Command c, Displayable display)
    {
    String label = c.getLabel();
    if (label.equals("Exit")){
      destroyApp(false);
    }
  }}

Sample Output:

comment bellow for Query and Feedback :)
Prof.Mahendra Kanojia


Step1:-   Go to the Ktoolbar of J2ME wireless toolkit from the Start menu.
Step2:- Select the new project tab and give a project name and MIDlet Class Name

Step3:- Select the option CLDC 1.1 ka option and remove the check mark of Mobile Media API

Step4:- The Following window appears


Step5:-   Go to C drive of your Computer 


Step6:- Select the WTK22 folder in C drive


Step7:-  Select the apps folder in the WTK22 folder


Step8:- Select the folder named same as the project we created (i.e. HelloWorld).


Step9:- Select the src folder inside the HelloWorld folder.


Step10:- Copy the HelloWorld.Java file in this src folder


Step11:- Return to the Ktoolbar and now Build the Application.


Step12:- Once the project is successfully built , run the application.


Step13:- OUTPUT

Step14:- Click the Right button on mobile to launch the application 


Comment bellow for Query and Feedback :)
Prof.Mahendra Kanojia

Monday, 16 January 2012



import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class LabelMIDlet extends MIDlet implements CommandListener
{
  private Display display;
  private Form form;
  private StringItem item;
  private Command next, exit;
  public LabelMIDlet()
{
    display = Display.getDisplay(this); 
    form = new Form("Label Text");
    item = new StringItem("UserId: ", "sandeep15284@rediffmail.com");
    next = new Command("Next", Command.SCREEN, 1);
    exit = new Command("Exit", Command.EXIT, 1);
    form.addCommand(exit);
    form.addCommand(next);   
    form.append(item);
    form.setCommandListener(this); 
  }
  public void startApp()
  {   
    display.setCurrent(form);
  }
  public void pauseApp(){ }
  public void destroyApp(boolean unconditional)
  {
    notifyDestroyed();
  }
  public void commandAction(Command c, Displayable s){
    String label = c.getLabel();
    if (label.equals("Next"))
{
      item.setLabel("E-MAIL ID: ");
      item.setText("sandeep15284@rediffmail.com");
      form.removeCommand(next);
    }
else if (label.equals("Exit"))
{
      destroyApp(true);} }}


Output:-




Prof.Mahendra Kanojia


J2ME Program to Display TextField
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class TextDemo extends MIDlet implements CommandListener
{
  private Display display;
  private TextField t2;
  private Form f1;
  private Command CMD_EXIT=new   Command("EXIT",Command.EXIT,1);
          public TextDemo()
          {
                   display=Display.getDisplay(this);
          }
          protected void startApp()
          {
                   t2=new TextField("NAME","  ",40,TextField.ANY);
                   f1=new Form("TEXT BOX DEMO");
                   f1.append(t2);
                   f1.addCommand(CMD_EXIT);
                   f1.setCommandListener(this);
                   display.setCurrent(f1);
          }
          protected void pauseApp(){}
          protected void destroyApp(boolean  unconditional) {}
          public void commandAction(Command c,Displayable d){
                    if(c==CMD_EXIT)
                   {
                             destroyApp(true);
                   }}}
OUTPUT

Prof.Mahendra Kanojia


J2ME Program for TextBox
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Commander extends MIDlet
{
public void startApp()
{
Displayable d = new TextBox("TextBox", "Address", 100, TextField.ANY);
Command c = new Command("Exit", Command.EXIT, 0);
d.addCommand(c);
d.setCommandListener(new CommandListener()
{
public void commandAction(Command c, Displayable s)
{
notifyDestroyed();
}
} );
Display.getDisplay(this).setCurrent(d);
}
public void pauseApp() { }
public void destroyApp(boolean unconditional) { }}

Output:- 

Prof.Mahendra Kanojia