Java Programing laungage

J2ME Projects

J2ME Project 1

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

Email Program


/*
 * Save as  a addEmailText.java
 */
package r4r.Mobile.Basic;

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

/**
 * @author R4R
 */
public class addEmailText extends MIDlet {

    /* -- private field -- */
    private Form form;
    private Display display;
    private TextField inputText;
    private Command exit;
				

    public addEmailText() {
        display = Display.getDisplay(this);
        form = new Form("Add Email Field into Form");
        inputText= new TextField("Write email Id", 
			"aaa@aaa.com", 40, TextField.EMAILADDR);
        exit= new Command("EXIT", Command.EXIT, 1);
        form.append(inputText);
        form.addCommand(exit);
    }

    public void startApp() {
        
        //add command listener functionality 
        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