Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes Calendar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Calendar" Watch "Calendar" New topic
Author

Calendar

Chandra Moulee
Greenhorn

Joined: Sep 26, 2005
Posts: 16
Hi,
How can we display a calendar using java.

Thanks

Mouli
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
there's a couple of parts to the display
1) a panel with 49 buttons or labels (7 x 7)
top row dispays the days of the week (Sun Mon Tue etc)
remaining 6 rows display the dates of the month
2) another panel with previous/next buttons (previous/next month)

put them together in a JDialog and you have a popup calendar

you need to work on getting the DAY_OF_WEEK of the first of the month to
determine which button displays "1", then increment the buttons from there
until getActualMaximum() is reached
Jared Cope
Ranch Hand

Joined: Aug 18, 2004
Posts: 243
Hi,

Someone has actually developed something like this and has made it available for free. I use this one and it works really nicely.

Take a look if you don't want to create your own from scratch.

http://www.toedter.com/en/jcalendar/

Cheers, Jared.


SCJP 1.4 91%, SCJP 1.5 88%, SCJD B&S
Stephen Boston
Ranch Hand

Joined: Jul 14, 2005
Posts: 165
And I found THIS very helpful.

Steve


Steve<br /> <br />No matter where you go, there you are.<br /> <br />"My evil self is at the door, and I have no power to stop it."
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Calendar
 
Similar Threads
public abstract class Calendar
Adding value to A Time
Word Games
checking for date
about subtract dates