PROGRAM:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Text extends MIDlet implements
CommandListener
{
private
Display display;
private
Form form;
private
Command submit;
private
Command exit;
private
TextField t;
public
Text()
{
display=Display.getDisplay(this);
exit=new
Command("exit",Command.EXIT,1);
submit=new
Command("submit",Command.SCREEN,1);
form=new
Form("SIGN IN");
t=new
TextField("First Name:","",30,TextField.ANY);
form.addCommand(exit);
form.addCommand(submit);
form.append(t);
form.setCommandListener(this);
}
public
void startApp()
{
display.setCurrent(form);
}
public
void pauseApp()
{
}
public
void destroyApp(boolean unconditional)
{
}
public
void commandAction(Command command,Displayable displayable)
{
if(command==submit)
{
t.setString("Hello,
"+t.getString()+",How r u?");
form.removeCommand(submit);
}
else if(command==exit)
{
destroyApp(false);
notifyDestroyed();
}
}
}
No comments:
Post a Comment
Thanks for your valuable comments