The Lake Applet
This applet and source code are delivered "as is". I accept no liability for any
loss or damage caused by the use of this software.
NB: This is NOT a screen saver. It is designed to be used purely within web
pages. If you would like some screen savers then try my page at:
In this zip file you should find the following:
* Lake.class - the Lake applet
* Lake.html - an example web page
* target.htm - test target file (simple page to hyperlink to)
dusk.gif - a couple of example images
* overlay.gif - a transparent image to demonstrate an overlay
* ReadMe.txt - this file
* source.zip - the source code
You should be careful to check that your unzipping program has named the files
correctly. Some DOS programs will name according to the old 8.3 format, renaming
the Lake.class file "Lake.cla". You can rename the file by opening up a DOS
window and typing:
ren lake.cla "Lake.class"
Using Lake in a web page
To include Lake in a web page, you should copy the Lake.class file into the
same directory as the web page and then insert an <APPLET...> tag into the page,
<APPLET CODE="Lake" WIDTH=250 HEIGHT=258>
<PARAM NAME=image VALUE="sunset.gif">
Put something here for browsers that don't use Java.
The Lake.class file is the only file from the zip archive that needs to be copied onto
The following parameters can be passed to Lake:
This parameter specifies the horizon picture that will be reflected in the
You can use this parameter if you want a static picture to overlay the
moving image of the lake. A good idea is to use a transparent .GIF for this
so that you will not hide to so much of the animation.
You can now use the applet as a hyperlink, by setting href to the name of the
page you want to link to.
If you are using the applet as a hyperlink then you can set this value to
specify the target frame. If you don't set a target value then the new page
appear in the current frame.
The height of the applet should 2 * (height of the image) - (a little bit).
How much is a little bit? Well it depends upon the height of you original image. The
best thing to do is to start with the applet height = 2 *(height of the original) - 10,
then play around a bit after that. Older versions of the applet were always shortened by
10, but it's now more flexible to give better perspective on smaller images.
I'd suggest you put the Lake.class file in the same directory as the page on
which it will appear. If you want to move it elsewhere
then use the "CODEBASE" option to point to the appropriate directory.
Some implementations of Java will not allow you to put the .class file in one
subdirectory and the image file in another. If the try it might cause a security
If you use this applet then it would be nice if you gave me a link by pasting the
following into your page.
<img src="http://www.demon.co.uk/davidg/images/dglogo.gif" width=88
It will put a little button on your page that will link through to my Java Spigots
It is only a request: feel free to omit it.
I've included all the project files for Microsoft's Visual J++, but you should be
able to use any JDK. If you use the source code to create another applet, then it
is only on the condition that you change the header:
// (c) David Griffiths, 1997
// This source code may not be reproduced without the express
// permission of the author.
// This applet is based on code created by David Griffiths
// (email - email@example.com; web site - http://www.demon.co.uk/davidg)
* Internet Explorer 3.02 seems to have a bug that can prevent the image appearing
if the page is opened directly from the hard disk. THe problem goes away when
the applet is loaded up onto the server.
* If you get a "class format error" then the applet has probably been corrupted
during transfer. Did you transfer it as a binary? It should be copied onto the
server in the same way that you copy graphics files.
* If you get "Lake class not found" then the Lake.class file has either not been
loaded onto the server or it has an inappropriate name. Some browsers are case
sensitive, so be sure to check the Lake.class file has not been switched into
uppercase (Windows Explorer is no help here as it displays uppercase filenames
in mixed case - the best way to check the case is by doing a "dir" from a DOS
* If the applet just says "Loading images..." when it is run off the server and
never shows the image, the chances are there are problems with the image. If the
image is too large then it may not be able to create the animation in
memory. On the other hand, it may be that the image is not accessible. Have
you spelt the image filename correctly in the <param name=image...> line? Again
you will need to check the case and also the file permissions.
* On some platforms (notably X terminals with very little memory) the animation
does not start properly. The reason for this is that the animation frames are
created in a buffer image. If the original image is large, then the frames
image will be very large. I'm thinking about changing the applet to create the
frames in real-time in these instances. However, the speed may be slowed down
sufficiently that a blank applet might be seen to be preferable.
* If you make the applet too large then you will notice a grey strip appear at
the bottom of it as the waves lap backwards and forwards. The solution is to
make the applet a bit smaller...
* On an artistic note, it is not a good idea to use an image that already has a
horizon. If you look across the surface of a lake you will not see the horizon
reflected in the surface. The best solution is to cut the image *at* the horizon.
* Do not use transparent GIFs with the applet's "image" parameter. There is no
problem using transparent GIFs for the overlay parameter - in fact this is
And finally, remember that if you are transferring the .class file to another
machine with FTP, you should set the 'binary' mode on. Failure to do so will
corrupt the file and give rise to a "Class Format" error.
Anyway, happy rippling. Keep a look out at