|Latest Release: Nov 15, 1996|
|Initial Release: Dec 05, 1995|
This is a simple digital clock written in Java. This clock can display time and date of any place in world. The time can be displayed in 12 hour or 24 hour format. The foreground and background colors of the digits can be changed. The clock can be wrapped with a ornamental frame as well.
You will need a java capable browser like netscape in order to view the clock. I compiled and tested the applet on DEC OSF/1 3.2 with JDK 1.0.2 and netscape 3.01.
This applet uses double-buffering technique, therefore, you should not see any flickering at all.
|My Time:||Your time:||Berlin:|
If you want to use this applet in your web page, you have to download the archive first. Then, you have to extract the necessary files from the archive. The archive is available in 3 formats, gzipped tar, unix compressed tar and zipped archive. Download any one of the archives depending on what kind of de-compressor you have.
The following files will be extracted to the current working directory. Make sure you do not have any files with those name in the directory or they will be over written.
- gzipped tar (jdgclock2.3.tar.gz)
[If you do not have gzip/gunzip, it is available at prep.ai.mit.edu].
- unix compressed tar archive (jdgclock2.3.tar.Z)
- zipped archive (jdgclk.zip)ColorFilter.class Dgclock.class Dgclock.html Dgclock.java Makefile README dgstrip.gifYou need Dgclock.class, ColorFilter.class and dgstrip.gif in order to run the applet. Please consider NOT running the applet remotely from this machine.
After downloading, copy the archive to your public_html directory (or wherever you keep your home pages).
If you downloaded the gzipped version, at the shell prompt, type:gunzip < jdgclock2.3.tar.gz | tar xvf - or gzip -d < jdgclock2.3.tar.gz | tar xvf -If you downloaded the unix compressed version, at the shell prompt, type:uncompress jdgclock2.3.tar.Z tar -xvf jdgclock2.3.tarIf you downloaded the zipped version, type:unzip jdgclk.zip
You do not need to compile the code in order to use it. Dgclock comes with pre-compiled classes
ColorFilter.class. If you want to play with the source, please look at Dgclock.java (it is in the distribution as well).
Now, from your web page, call the applet as below:<applet code="Dgclock.class" width=100 height=30></applet>This will show the visitor's time in 24 hour format. To display the time in 12 hour format, use:<applet code="Dgclock.class" width=100 height=30> <param name="TimeFormat" value="%I"> </applet>To display your time, you have to know your timezone offset from GMT. For example, if you live in New York, your timezone offset is 5 hours east of Greenwich meridian. Note, offset is negative for east and positive for west.
For New York:<applet code="Dgclock.class" width=100 height=30> <param name="TZ" value="GMT-0500"> </applet>
Note, you can not use just -5, you must use the four digit offset starting with GMT+ or GMT-. If your timezone offset is 4 hours, 30 minutes west of Greenwich meridian, the param line will be:<param name="TZ" value="GMT+0430">To display GMT, the param line will be:<param name="TZ" value="GMT+0000">To display date with time:<applet code="Dgclock.class" width=100 height=30> <param name="TZ" value="GMT-0500"> <param name="ShowDate" value="yes"> </applet>
If you do not want to display the frame around the clock, use:<applet code="Dgclock.class" width=89 height=20> <param name="ShowFrame" value="no">
If you move the mouse cursor on the clock while it is running, the version information is displayed on netscape's status area. If you do not want this, use:<param name="ShowVersion" value="no">If ShowVersion is "no", when the mouse pointer is moved over the clock, it will display the timezone offset from GMT in the netscape status area.
To change the foreground and background color of the digits, the parameters fg and bg can be used respectively.<param name="fg" value="red">The value of fg and bg can be one of the following color namesred,green,blue,cyan, magenta, yellow,orange, pink,black,whitea 6 digit hex number like ff0000. Example:<param name="fg" value="yellow"> <param name="bg" value="red"> <param name="bg" value="d3b5b5"> <param name="fg" value="000000">
Inspired by World TIme applet and Clock2 applet.
This applet is in the public domain. Do anything you like with it. It would be nice but not required if you give me the credit for it.If you are using this applet, please let me know. Bug reports, suggestions are always welcome!
1. I followed your instructions exactly, but the clock does not show up. Instead it shows a solid rectangle. What's wrong?
Several things may cause this problem:
- File permission problem. Change the mode of the files accordingly (unix):chmod 644 ./Dgclock.class chmod 644 ./ColorFilter.class chmod 644 ./dgstrip.gifIf you see the message Loading image...please wait! at netscape's status message area for ever, this is an indication that the image loading is failed possibly because it could not find the stip image file
dgstrip.gifor the image file is are not readable.
- You are using an old version of web browser.
- Foreground and Background color can be changed. (11/15/1996).
- Uses image strip instead of individual digit images. (11/02/1996)
- The default 24 hour time format was not working. Thanks to Amy and Cary for pointing it out. (March 20, 1996).
- Using MediaTracker class to avoid incremental display of digit images. That is, the time will be displayed after all the images are loaded completely. Suggested by Jim Graham
- The clock can be displayed without frame (default is to use frame).
- The clock can be stopped by clicking a mouse button on the applet. Clicking again will restart the clock.
- Displays "Loading image.." message at netscape's status area while the images are being loaded.
Last updated: November 15, 1996.