DateFieldInitDemo.java
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:

J2ME

开发平台:

Java

  1. import javax.microedition.lcdui.*;
  2. import java.util.*;
  3. import javax.microedition.midlet.MIDlet;
  4. public class DateFieldInitDemo  extends MIDlet implements CommandListener
  5. {
  6.     private final static Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
  7.     private DateField item;
  8.     private Form mainForm;
  9.     public DateFieldInitDemo() {
  10.     mainForm = new Form("DateField演示");
  11.     }                                                        
  12.     protected void startApp() {
  13.             item = new DateField("Date", DateField.DATE);
  14.             item.setDate(new Date());
  15.            /* Date mDate = new Date();
  16.             System.out.println(mDate.getTime());
  17.             System.out.println(System.currentTimeMillis());*/
  18.             mainForm.append(item);
  19.             mainForm.addCommand(CMD_EXIT);
  20.             mainForm.setCommandListener(this);  
  21.             Display.getDisplay(this).setCurrent(mainForm);
  22.             
  23.     }
  24.     protected void destroyApp(boolean unconditional) {
  25.     }    
  26.     protected void pauseApp() {
  27.     }   
  28.     public void commandAction(Command c, Displayable d) {
  29.         if (c == CMD_EXIT) {
  30.             destroyApp(false);
  31.             notifyDestroyed();
  32.         }
  33.     }    
  34. }