This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes how to create a Calendar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to create a Calendar" Watch "how to create a Calendar" New topic

how to create a Calendar

Praveen Sharma
Ranch Hand

Joined: Jul 31, 2008
Posts: 129
I am new to Swing. I want to add a calendar control to my swing application. Please suggest me how to create a calendar component.

SCJP 80% SCWCD 89%
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10651

Well you will need the following things
1) A panel or some suitable container with a grid layout
2) Labels to display the week days as well as the dates
3) GregorianCalendar has all the methods you will require to figure out stuff like leap year, number of days in a month, day on a particular date etc.
4) If you want to make the calendar more interactive (user clicks on some date and views say his appointments for that particular date, use buttons instead of labels.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
zohaib shiekh

Joined: Apr 03, 2011
Posts: 4
JCalender provide a facility to integrate Calender component with your Swing application
Download this Component from webpage
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 41104
Is that the same as this calendar?
zohaib shiekh

Joined: Apr 03, 2011
Posts: 4
No this component is more easy then this
its very easy to integrate with swing
I agree. Here's the link:
subject: how to create a Calendar