Date Field Midlet Example

This example illustrates how to insert date field in your form.

Date Field MIDlet Example


This example illustrates how to insert date field in your form. We are using here two fields DateField (datein and dateout) and initialize a final static variable DATE which is 0. We are taking both DateField variable in to the constructor (DateFieldExample). When application will run, first of all the startApp() method will be called and it will display the form with datein and dateout field. For the specific date we are using here java.util.Date class and java.util.TimeZone class is used to show the format of date like in figure Tue, 30 Sep, 2008

Application display as follows:

When <date> is selected, a new window will open with a calendar as given below.

and you can select your choice of date, month and year which will appear on the form as follows. 


The source code of the is as follows:  

import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import java.util.Date;
import java.util.TimeZone;

public class DateFieldExample extends MIDlet{
  private Form form;
  private Display display;
  private DateField datein, dateout;  
  private static final int DATE = 0;

  public DateFieldExample(){
  datein = new DateField("Date In:", DateField.DATE, TimeZone.getTimeZone("GMT"));
  dateout = new DateField("Date Out:", DateField.DATE, TimeZone.getTimeZone("GMT"));

  public void startApp(){
  display = Display.getDisplay(this);
  Form form = new Form("Date Field");

  public void pauseApp(){

  public void destroyApp(boolean destroy){

Download Source Code

Share on Google+Share on Google+

Date Field Midlet Example

Posted on: October 3, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Date Field Midlet Example   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
May 31, 2012