The Java Clock

This stunning Java applet is the only fully customisable Java Clock on the web. It should liven up even the dullest of websites.

All visible details including the face and hands can be customised. If you wish to use your own images as the face and hands of the clock then simply provide the following images in a directory on your web server:

clock.gif - The background face of the clock. Any transparent pixels will displayed as white.

second.gif - The seconds hand of the clock.

minute.gif - The minutes hand of the clock.

hour.gif - The hours hand of the clock.

Feel free to modify the existing gif files used by the above applet. The easiest way to customise the clock is to modify the "clock.gif" file and include the other 3 gif files in your directory (the hand images have been anti-aliased against a white background and so they will appear bordered if your clock.gif uses dark colours). Download JavaClock.zip and include the class files in your HTML directory (example gifs are also included in the zip file). Then include the HTML source (shown below) in your web page. The "imageurl" parameter should point to the directory on your webserver where the gif images have been placed.

<applet
code=Clock.class
id=Clock
width=100
height=100>
<param name=imageurl value="http://www.mywebserver.com/clock_gifs/">
</applet>

If you do not wish to use your own images then do not include any parameters in the applet tag.


To get an idea of how best to draw the the images look at the existing ones provided with this applet. The size of the clock, by default is 100x100 pixels and so this should be the size of clock.gif. The size of the clock can be changed by changing the height and width of the applet within the applet tag. The size of the clock.gif image should reflect the size of the applet. The gif files that represent the hands of the clock should have a transparent background. Below are the gif files used in the above applet (each image is displayed with a border to show the sizes involved). Note how the hands have been drawn (ie the space left below the image). This is essential for the hands to display properly. For best looks use an create anti-aliased gif images as this will reduce jagged edges on the clock.

To use this applet in a small window of its own. Click Here

The Possibilities are endless. I Look forward to seeing your own examples of this applet in action!!!

Click to View my home pages and see further examples of clocks. All take a look at Java Clock Pro which has the ability to dynamically show the time in any timezone!

Comments and feedback to [email protected]

Copyright © Naeem Malik 1998. All rights Reserved.
Permission to use this applet for NON-COMMERCIAL purposes and without fee is hereby granted.