A DateField class is an editable component for display of date/time (calendar) information on mobile device.

Below is the illustration for display of Calendar on mobile screen.

 import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;

public class displayCalendar extends MIDlet
implements CommandListener, ItemStateListener
{
  private Command exit;
  private Display display;
  Form form;
  DateField date;

  public displayCalendar()
  {
    
    exit = new Command("Exit", Command.SCREEN, 1);
    date = new DateField("Select date", DateField.DATE);
  }

  public void startApp() 
  {
    form = new Form("Calendar");
    form.append(date);
    form.addCommand(exitCommand);
    form.setCommandListener(this);
    form.setItemStateListener(this);
    display = Display.getDisplay(this);
    display.setCurrent(displayForm);
  }

  public void itemStateChanged(Item item)
  {
    // Get the values from changed item
  }

  public void pauseApp() { }

  public void destroyApp (boolean unconditional) { }

  public void commandAction (Command c, Displayable s) 
  {
    if (c == exit) 
    {
      destroyApp(false);
      notifyDestroyed();
    }
  }
}