/ * * Datefieldlet.java * * CREATED ON April 15, 2005, 11:32 AM /
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 command (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, Afe);}}}