/*
* dateFIEldlet.Java
*
* Created on 2005年4月15日, 上午11:32
*/
import Javax.microedition.midlet.*;
import Javax.microedition.lcdui.*;
/**
*
* @author Administrator
* @version
*/
public class dateFIEldlet extends MIDlet implements CommandListener{
private Form aForm;
private Display aDisplay;
private DateField aDateFIEld;
private Command exitCommand;
private Command okCommand;
private Alert anAlert;
public dateFIEldlet(){
anAlert=new Alert("Today",null,null,AlertType.INFO);
anAlert.setTimeout(3000);
exitCommand=new Command("EXIT",Command.EXIT,1);
okCommand=new Command("OK",Command.EXIT,1);
aForm=new Form("DateFIEldTest");
aDateField=new DateField("Today’s date:",DateFIEld.DATE_TIME);
aForm.append(aDateFIEld);
aForm.addCommand(exitCommand);
aForm.addCommand(okCommand);
aForm.setCommandListener(this);
}
public void startApp() {
aDisplay=Display.getDisplay(this);
aDisplay.setCurrent(aForm);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c,Displayable d){
//int i=0;
String s="";
if(c==exitCommand){
destroyApp(false);
notifyDestroyed();
}
else{
s=aDateFIEld.getDate().toString();
anAlert.setString(s);
aDisplay.setCurrent(anAlert,aForm);
}
}
}