Dgclock in Java (1.0 applet)

Version 2.1

Initial Release: Dec 05, 1995
Latest Release: March 16, 1996

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. You will need a java capable browser like netscape in order to view the clock. I tested the applet on Solaris 2.3 and Microsoft NT 3.51 with applet viewer and netscape 2.01.

This applet uses double-buffering technique, therefore, you should not see any flickering at all.

Examples


- It may take some time to transfer -

My Time: Sorry Your browser is not java capable Your time: Berlin:
Dhaka: New York: London:

What's new

How to use it

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 decompressor you have.

Download

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.1.tar.gz | tar xvf -
      or
    gzip -d < jdgclock2.1.tar.gz | tar xvf -
If you downloaded the unix compressed version, at the shell prompt, type:
    uncompress jdgclock2.1.tar.Z
    tar -xvf jdgclock2.1.tar
If you downloaded the zipped version, type:
    unzip -d jdgclk.zip
The -d switch makes sure that it creates the jimages directory and put the digit images inside it. If you are using some other kind of unzipping software, make sure it creates the jimages directory.

You do not need to compile the code in order to use it. Dgclock comes with pre-compiled class Dgclock.class. If you want to play with the source, please look at Dgclock.java.

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">
    
Note the line:
    <applet code="Dgclock.class" width=89 height=20>
That is, when you do not want to display the frame, you must use the width and height as above.

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">
    

Acknowledgment

Inspired by World TIme applet and Clock2 applet.

Copyright

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!

Frequently Asked Question(s)

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:

  1. File permission problem. Change the mode of the files accordingly:
        chmod 644 Dgclock.class
        chmod 755 jimages
        chmod 644 jimages/*.gif
    
    If you see the message Loading images...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 images or the images are not readable.

  2. You are using an old version of web browser. This is a 1.0 applet, therefore, you must have netscape 2.0+.

  3. Your unzip'ng software did not create the jimages directory for images, instead it copied all digit images to current working directory. This applet expects the digit images to jiamges directory.
Enjoy!
Muhammad A Muquit
SEMCOR, Inc.
Warminster, PA 18974


Last updated: March 16, 1996.

[Homepage]