Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home J2me J2ME Calendar Application

Related Tutorials


 
 

Share on Google+Share on Google+

J2ME Calendar Application

Advertisement
Creating a calendar is a very basic example to learn any programming language.

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

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 19, 2008

Related Tutorials

Discuss: J2ME Calendar Application   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:6
Fez
April 17, 2011
How to show day names too in the same calender?

Thanx for the tutorial, but i was wondering how to show the name of the days in the same calender too. I mean this calender doent shoe name of the days like snday monday.. .. Please help me on this.. looking for single line of code that can do the trick.. Thanx
Fez
April 17, 2011
how to display day names

Thanx for the tutorial, but i was wondering how to show the name of the days in the same calender too. I mean this calender doent shoe name of the days like snday monday.. .. Please help me on this.. looking for single line of code that can do the trick.. Thanx
hfyt
September 4, 2011
dffjh

there is no output
lst
September 4, 2011
complaint

there is no output full of code error plz change the code
Allan
September 21, 2012
Calendar

Hi av been checking out your codes for a while they are very helpful. Thank you. wanted to ask is there a way one can incorporate a note pad functionality in an app. Where one can write save and retrieve the notes later? Thank You.
Loll
November 5, 2013
No output

No output is being displayed even though it got built
DMCA.com