package unit3;
import java.util.Date;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class DateEx extends MIDlet implements CommandListener
{
private Display d;
private Form f;
private Date dat;
private Command exit;
private DateField df;
public DateEx()
{
d=Display.getDisplay(this);
f=new Form("To day's date");
dat=new Date(System.currentTimeMillis());
df=new DateField("",DateField.DATE_TIME);
df.setDate(dat);
exit=new Command("Exit",Command.EXIT,1);
f.append(df);
f.addCommand(exit);
f.setCommandListener(this);
}
public void startApp() {
d.setCurrent(f);
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c,Displayable dd)
{
if(c==exit)
{
destroyApp(false);
notifyDestroyed();
}
}
public void pauseApp() {
}
}
import java.util.Date;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class DateEx extends MIDlet implements CommandListener
{
private Display d;
private Form f;
private Date dat;
private Command exit;
private DateField df;
public DateEx()
{
d=Display.getDisplay(this);
f=new Form("To day's date");
dat=new Date(System.currentTimeMillis());
df=new DateField("",DateField.DATE_TIME);
df.setDate(dat);
exit=new Command("Exit",Command.EXIT,1);
f.append(df);
f.addCommand(exit);
f.setCommandListener(this);
}
public void startApp() {
d.setCurrent(f);
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c,Displayable dd)
{
if(c==exit)
{
destroyApp(false);
notifyDestroyed();
}
}
public void pauseApp() {
}
}
No comments:
Post a Comment