Welcome to W3C time!
Each clock is an instance of the tz class, so it needs to have the file tz.class
accessible, tz.class in turn makes use of Clock.class so that file needs
to be in the same directory as tz.class. (It is possible to put the two files
in a jar file, which may save some download time.)
Paris
(Texas that is) |
The time at
MIT |
Holt (near
Trowbridge) |
Saint Tropez
& Mallorca |
The land of
the rising sun |
|
|
|
|
|
Here is an example applet for California (Pacific time):
<applet code="tz.class" width=150 height=220
align=right>
<param name="tz" value="America/Los_Angeles">
<param name="language" value="en">
<param name="country" value="GB">
<param name="bgcolor" value="0000ff">
<param name="color" value="ffffff">
<param name="textcolor" value="ffff00">
<param name="daycolor" value="ffaaaa">
<param name="nightcolor" value="ffaaaa">
<param name="seconds" value="on">
<param name="style" value="3">
Your browser is not configured to show Java applets.
This would show a clock with the time in California.
</applet>
You can set the width and height attributes of the applet, and the clock
will fill the given space. However, the text (date, time and digits on the
dial) will not change size.
The parameters for the tz applet are:
-
tz
-
Timezone. Each timezone is represented by a continent and a city
and the format of the parameter is "Continent/City". E.g.,
"America/New_York" or "Australia/Sydney". For a list of available
cities, see, e.g., the time zone
selector wiki.. The list is normally also installed somewhere
on your computer. On Unix systems (including Mac OS X), the list
is in /usr/share/zoneinfo. (Note that in old versions of Java,
only 3-letter codes, such as JST for Japan and MST for US Mountain
Time, are available instead of cities. But since about 2007, those
three-letter codes don't include daylight savings time anymore and
so it is better to avoid them.)
-
language
-
Which language you want the digital time to be shown in. A two-letter code,
such as "en" for English.
-
country
-
Which local variant of the language you want, for example "GB" to get British
English.
-
bgcolor
-
The color of the applet outside of the clock dial itself; a hex number, such
as "ffffff" for white.
-
color
-
The color of the hour and minutes hand, but only in the day time. The color
will be automatically adjusted to keep enough contrast with the night color.
A hex color, such as "0000ff" for blue.
-
textcolor
-
The color for the digits and the seconds hand, also only in the day time.
A hex number, such as "000000" for black.
-
daycolor
-
The color of the dial at noon. the dial will change color every half hour,
gradually moving from the daycolor to the night color. (Often the colors
don't come out right, at least on NS 4beta under Solaris. I suspect some
problems in the color handling for Java, since NS4 also locks up when an
applet cannot get enough color cells on my 8bit display. Or maybe there is
a bug in my code...) A hex color such as "fff030" for a light yellow.
-
nightcolor
-
The color of the dial at midnight. A hex number such as "6040a0" for a slightly
purple blue.
-
seconds
-
Whether to display a seconds hand or not. Displaying the seconds hand makes
the Java VM work a lot harder. In MSIE4 it doesn't seem to matter, but Netscape
on Solaris slows annoyingly when there are five clock applets running that
update every second... The value is either "on" or "off".
-
style
-
The style for the date, either 0, 1, 2, or 3. Default is "2"
-
"0" = "Wednesday, 15 October 1997"
-
"1" = "15 October, 1997"
-
"2" = "15-Oct-97"
-
"3" = "15/10/97"
(Sources: tz.java and
Clock.java.
Copyright.)
Bert Bos
$Date: 2008/03/10 13:47:18 $