by Neil Rieck
Unlike many Java Applet Calendars which are based upon the "Date" function, this one
is based upon the "GregorianCalendar" function which was introduced in JDK1.1
The "correction date" is defaulted to October 15, 1582
where Pope Gregory authorized the removal of 10 days.
(along with special leap-year cases for 100 and 400 year boundaries)
click here if the
applet doesn't initialize
(will never initialize with JRE 22.214.171.124 (2014) due to security issues)
Neapolitan astronomer Aloysius Lilius noticed that the Julian calendar (which
had a leap year every 4 years ) was too long by 11 minutes and 14 seconds per
which translated into a discrepancy of almost 9.8 days2a
by the year 1582. In order to make the calendar keep in sync with the heavens,
he suggested that centuries which are evenly divisible by 100 should not be leap
years except those which are evenly divisible by 400.
Easter was originally linked to Passover, but in the year 325 AD at the council at Nicaea, it was decided that Easter would be celebrated on the first Sunday following the first full moon on, or after, the vernal equinox (the passing from winter into spring). In the year 325, the vernal equinox was assumed to be fixed at March 21.
Due to inaccuracies in the Julian calendar, by the 16th century the vernal equinox was occurring on March 11. This caused problems for the church in Rome because most Christians outside of Rome were using the calendar date of "March 21" to calculate the day of Easter rather than the "vernal equinox" event. (sometimes bad weather combined with a lack of local astronomers make the calendar method the only practical choice). This had the effect of pushing the celebration day of Easter closer toward summer.
Note: Christmas was a relatively unimportant church event in those days and was created only to obscure pagan rituals like The Feast of Saturnalia etc. The changing of these calendars is one reason why eastern Europe celebrates Christmas on Jan 6 but I'll leave that for another time partly because that correction involves 12 days.Pope Gregory XIII assigned the problem to a Jesuit astronomer named Christopher Schlussel (a.k.a. Clavius) who suggested that the equinox problem could be solved by removing 10 days from the current year but from that time forward, the Christian world should adopt the idea proposed by Aloysius Lilius. The plan was approved by Pope Gregory who decreed that October 4, 1582 would be followed by October 15. The peasants revolted thinking that their lives had been shortened by that much. The new calendar was named the Gregorian calendar after the pope who approved the changes.
|1||current year/400|| = 0
|yes (exit algoithm)
??? (do next test)
|2||current year/100|| = 0
|no (exit algorithm)
??? (do next test)
|3||current year/4|| = 0
|1||current year/4||<> 0
|no (so exit)
??? (so do next test)
|2||current year/100||<> 0
|yes (so exit)
??? (so do next test)
|3||current year/400||<> 0
|Year 2||Year 1||year
|a||1582 AD||325 AD||1257||x 676||= 847218||09.805763889||Europe|
|b||1752 AD||325 AD||1427||x 676||= 961798||11.1319213||England and America|
More Calendar Links:
Possible Failure Modes:
Click here to download a free JVM from the Sun web site.
Note: "JVM 1.3" and "JVM 1.4" only support "Netscape Navigator 6" and any version of Internet Explorer. You shouldn't be using any version of Netscape Navigator that is pre version 6 (unless the web page uses the <Object> tag rather than the <Applet> tag)
Programmer Tips:Old Browsers and/or JVMs
Old Browsers with new JVMs
In a business environment your clients are usually on a high speed intranet and it's not unreasonable to to expect that everyone will have the latest browser and JVM (Java Virtual Machine). In this environment you may use the latest Java programming techniques and the latest JVMs. However, on the public internet you must assume that many people are using:
- older machines with smaller memories
- older browsers (like Netscape 4)
- earlier JVMs (like version 1.1 which is built into Netscape 4)
- older dialup technology like 28.8 kb or 56 kb modems (which means they won't be downloading a new browser or JVM just to run your applet)
For this reason if you don't want to ostracize certain segments of the public, you must program using JDK 1.1 which means you must use general graphics classes rather than Swing graphics etc.
Please note that this might be a little harder than it sounds. The calendar applet above was first written using SDK 1.3 with Swing graphics. To modify it for use with SDK 1.1 I had to do the following:
- drop the "J" prefix from each graphic class
- change code written for class Rectangle2D to just Rectangle
- find a suitable replacement for Font method getFontRenderContext()
- write some code to replace GregorianCalendar method getActualMaximum(Calendar.DAY_OF_MONTH)
Some older browsers like Netscape 4.x have a built in JVM 1.1 while other browsers don't support Java at all. You can force a browser to use an external JVM by replacing the <Applet> tags on your web pages with <Object> tags. Fortunately, this conversion is done for you when you run a program called HtmlConverter in the JDK bin directory.
Java Rev Numbers:
SDK (JDK) Marketing Basic Features Miscellaneous Notes 1.0 1.0 Introduction 1.1 1.1 Graphics Built into Netscape Navigator 4.x 1.2 Java2 Swing Graphics Swing graphic classes contain a 'J' prefix.
eg. Panel becomes JPanel, Applet becomes JApplet, etc.
1.3 Java2 CORBA ORB JApplet requires 3 methods: start(), stop(), init()
a second Timer() method was added
Support for Open-JVM Interface (Netscape 6)
1.4 Java2 Unicode 3, XML JApplet requires 1 method: init()
Kitchener - Waterloo - Cambridge, Ontario, Canada.