IBM

Word Clock applet

This example is an applet which displays a clock, in words; it follows the algorithm used in one of the earliest Rexx programs, QTIME, for generating the words.

Here's the source, as a plain ASCII file.

The applet has similarities to the 'Nervous Texxt' applet; it wakes up every minute to redisplay the time. Optional parameters may be supplied to select the font face and size.

The applet is compiled using the same steps as for the 'Hello World' applet. To have the applet displayed in World Wide Web page, you need to

  1. place the class file in the same directory as the page in which is is to appear
  2. refer to it, wherever you want it to appear on the page, with the <applet> tag:
    
      <applet code="WordClock.class" width=400 height=40>
    
      <param name=face value="Helvetica">
    
      <param name=size value="20">
    
      </applet>
    
    

    which sets the maximum size for the window in which the applet will appear, and the face and size at which the clock will appear.

  3. place a copy of the NetRexx class files (e.g., from NetRexxR.zip) in a subdirectory netrexx/lang relative to the directory that holds the WordClock.class file. You don't need to do this if you are viewing the applet on a machine where NetRexx has been installed.

You can then view the page with any Java-enabled browser, or with the 'applet viewer' that comes with the Java Development Kit. If you are using such program, you should see the applet below here.

For more details on running applets, see the Hello World applet page.


[ IBM | Help | Legal | Privacy ]