[an error occurred while processing this directive]

J2ME Calendar Application

                         

Creating a calendar is a very basic example to learn any programming language. At our website (roseindia.net), you can find many examples on creating calendar in Java, JavaScript etc. But in this example you will learn how to create a calendar in J2ME. 

In this example we have imported java.util.Date and java.util.TimeZone, that are required to create the calendar. Further we have created a constructor of the class CalenderMIDlet, and defined the given syntax into it to create a calendar.

 

 

 

 

  public CalenderMIDlet(){
    calender = new DateField("Date In:", DateField.DATE, TimeZone.getTimeZone("GMT"));
  }

Output of the application will look like as follow..

J2ME Calendar

 

Source Code of CalenderMIDlet.java

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

public class CalenderMIDlet extends MIDlet{
  private Form form;
  private Display display;
  private DateField calender;  
  private static final int DATE = 0;

  public CalenderMIDlet(){
    calender = new DateField("Date In:", DateField.DATE, TimeZone.getTimeZone("GMT"));
  }

  public void startApp(){
    display = Display.getDisplay(this);
    Form form = new Form("Calender");
    form.append(calender);
    display.setCurrent(form);
  }

  public void pauseApp(){}

  public void destroyApp(boolean destroy){
    notifyDestroyed();
  }
}

 

Download Source Code

                         

[an error occurred while processing this directive]