Java Programing laungage

J2ME Projects

J2ME Project 1

adplus-dvertising
Creating a J2ME Application for addPhoneNumberText into Form
Previous Home Next

PhoneNumberText Program


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package r4r.Mobile.Basic;

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

/**
 * @author Sachin
 */
public class addPhoneNumberText extends MIDlet {

    /* -- Private Field -- */
    private Form form;
    private Display display;
    private TextField inputNumber;
    private Command exit;

    /* -- Default constructor -- */
    public addPhoneNumberText() {
        display = Display.getDisplay(this);
        form = new Form("Add PhoneNumber Field into form");
        inputNumber = new TextField("Phone Number", "", 40, 
			TextField.PHONENUMBER);
        exit = new Command("EXIT", Command.EXIT, 1);

        // Add field into form
        form.append(inputNumber);
        form.addCommand(exit);
    }

    public void startApp() {
        form.setCommandListener(new CommandListener() {
				

            public void commandAction(Command c, Displayable d) {
                if (c == exit) {
                    destroyApp(true);
                    notifyDestroyed();
                }
            }
        });
        display.setCurrent(form);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
}

output
Previous Home Next