import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class dateTime extends MIDlet implements CommandListener{
private final static Command cmdExit=new Command("Exit",Command.EXIT,1);
private Form f;
public DateField d;
public dateTime() {
f=new Form("DateFiled");
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO 自动生成方法存根
}
protected void pauseApp() {
// TODO 自动生成方法存根
}
protected void startApp() throws MIDletStateChangeException {
d=new DateField("Time",DateField.DATE_TIME);
d.setDate(new Date()); //这行错误提示为Date无法解析为类型!
f.append(d);
f.addCommand(cmdExit);
f.setCommandListener(this);
Display.getDisplay(this).setCurrent(f);
}
public void commandAction(Command c,Displayable d){
if(c==cmdExit){
notifyDestroyed();
}
}
}