TheLakeApplet

LICENSE

This license ("License") contains rights and restrictions associated with use of the accompanying software. Read the License carefully before utilizing the software. By using the software you agree to be bound by the terms and conditions of this license.

  1. Limited License Grant. David Griffiths ("The author") grants to you ("Licensee") a nonexclusive, nontransferable, worldwide, royalty-free license to use this The Lake Applet software (the "Software"). Licensee agrees that it shall not use the Software for computer operations of any critical nature.
  2. Source Code Whilst the author may occasionally make source code available, it is NOT in the public domain and the author retains full copyright over it. UNDER NO CIRCUMSTANCES may software be sold containing code derived from this source code without David Griffiths giving his explicit permission.
  3. Restrictions. The Software is copyrighted and title to all copies is retained by the author. Licensee shall not make copies of Software, other than a single copy of Software in machine-readable format for back-up or archival purposes and, if applicable, Licensee may print one copy of on-line documentation, in which event all proprietary rights notices on Software and on-line documentation shall be reproduced and applied to all copies. Unless enforcement of this provision is prohibited by applicable law, Licensee shall not modify, decompile, disassemble, decrypt, extract, or otherwise reverse engineer Software. Software may not be transferred, leased, assigned, or sublicensed, in whole or in part.
  4. Disclaimer of Warranty. The Software is provided "AS IS," without a warranty of any kind. ALL EXPRESS OR IMPLIED REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANT-ABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
  5. Limitation of Liability. IN NO EVENT WILL THE AUTHOR BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  6. Termination. Licensee may terminate this License at any time by destroying all copies of Software including any documentation. This License will terminate immediately without notice from David Griffiths if Licensee fails to comply with any provision of this License. Upon termination, Licensee must destroy all copies of Software.
  7. Severability. If any of the above provisions are held to be in violation of applicable law, void, or unenforceable in any jurisdiction, then such provisions are herewith waived to the extent necessary for the License to be otherwise enforceable in such jurisdiction, However, if in the author's opinion deletion of any provisions of the License by operation of this paragraph unreasonably compromises the rights or liabilities of the author, David Griffiths reserves the right to terminate the License and refund the fee paid by Licensee as Licensee's sole and exclusive remedy.
  8. Integration. This Agreement is the entire agreement between Licensee and David Griffiths relating to Software and: (i) supersedes all prior or contemporaneous oral or written communications, proposals and representations with respect to its subject matter; and (ii) prevails over any conflicting or additional terms of any quote, order, acknowledgment, or similar communication between the parties during the term of this Agreement. No modification to the Agreement will be binding, unless in writing and signed by a duly authorized representative of each party.

Congratulations...

...upon choosing this product. Not only will it improve your health, and enhance your general spirituality, it will also clean the bath, cook you breakfast, take care of the children, end armed conflict and invigorate the look of your web page.

Introduction

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, rename .class files "*.cla".

The Gallery Example


Rocking
Underwater
NB: If you cannot see an applet above, then you may need to extract more files from the .ZIP archive before reading this page.

The code which produces the above is:


<applet code=lake name=lake1 width=250 height=250>
<param name=image value="scenic.jpg">
<param name=href 
  value="http://www.demon.co.uk/davidg/spigots.htm">
</applet>

<form>
<img src="sunset_button.jpg" 
  onmouseup="lake1.setImageValue('sunset.jpg');">
<img src="city_button.jpg"
  onmouseup="lake1.setImageValue('city.jpg');">
<img src="scenic_button.jpg" 
  onmouseup="lake1.setImageValue('scenic.jpg');">
<img src="clouds_button.jpg"
  onmouseup="lake1.setImageValue('clouds.jpg');">
<br>
<input type=checkbox value="Rocking on" 
  onClick="lake1.toggleRocking();">Rocking
<br>
<input type=checkbox value="Underwater on" 
  onClick="lake1.toggleUnderwater();">Underwater
</form>

Paying for the Applet

There is NOTHING to pay. The applet is completely free. However, if you make a donation ($5 - $10?) to Ty Hafan, Children's Hospice of Wales, which is a charitable appeal formed to build, equip and run a Children's Hospice in Wales to provide care for terminally ill children, you can consider your applet well-and-truly registered. Click here for details on how to make a donation. They now have an excellent new OnLine donation page. In just a few minutes you can change a few old, crinkly, dirty little bank notes into a nice warm glow...

New features in version 4.0

*. Speed configurable
You can now change the speed of the wave animation. To do this change the "speed" parameter to a value from 1 - 100 (the default is 50).
*. Horizons inside the image
For an image of, say, an ocean, you may not want to reflect the image, but animate the water instead. You can now animate entirely within an image by setting a "horizon" value.

The Dummy's Guide

If you get lost following these instructions, then there is an online "Dummy's Guide" at http://www.spigots.com/lakeinst.htm. I shall continue to update this guide to cover any steps that people find problematical.

Using lake in a web page (With FrontPage 98)

1. Create a (temporary) directory for the files (e.g. c:\lake)
2. Unzip all of the files into the directory
3. Start FrontPage 98
4. Open the appropriate web
5. Change to the folder in the web that contains the page which will contain the lake
6. Choose "File/Import" from the menu
7. When the "Import" dialog appears, click the "Add File" button.
8. Change the "Open File" dialog to the lake directory (e.g. c:\lake)
9. Select all of the files in the directory (you can do this by clicking the first file, then holding down the "CTRL" key and clicking each of the other files in sequence)
10. Click the "Open" button to close the "Open File" dialog.
11. Click the "OK" button to start the import of the files.
12. The files should now appear in the contents of the FrontPage folder.
13. Double-click the page that you want to insert a lake in.
14. Once the page opens, move the cursor to the place on it where you want the lake to appear.
15. Choose "Insert/Image..." from the menu
16. When the "Image" dialog appears, change to the folder containing the file you want to appear at the back of the lake. Click this file once and note down (on a piece of paper) the value which appears in the "URL" field.
17. Now click the "OK" button. The image will now be inserted into page. But it will not yet be rippling.
18. Right-click the image and choose "Image properties" from the menu.
19. When the "Image Properties" dialog appears, switch to the "Appearance" tab.
20. In the size section you should have values for the "Width" and "Height" of the image. Note these down on the same piece of paper that you noted the "URL" value on.
21. Click the "Cancel" button.
22. Delete the image you have just inserted. You should be able to do this by just clicking the "Delete" key.
23. Choose "Insert/Advanced/Java Applet" from the menu.
24. In "Applet Source" enter "lake"
25. In the section labelled "Applet Parameters" click on the "Add..." button.
26. Enter "image" in the "Name" field
27. Go to the "Value" field and enter the "URL" value that you previously wrote down on the piece of paper.
28. Click the "OK" button.
29. You should now be back in the "Java Applet Properties" dialog. In the "Size" section, click the mouse in the "Width" field.
30. Replace the current value with the "Width" value that you noted on the piece of paper.
31. Now click your mouse in the "Height" property.
32. VERY IMPORTANT: You should now enter a value that is 1.8 times the value for the height that you noted down on the piece of paper. So, for instance, if you originally noted down a value of "100", you should enter 180 into this field.
33. Click the "OK" button. You should now have a large "J" on the page.
34. To see the applet running, click on the "Preview" tab at the bottom of the page.
35. You have set up lake to run with a single "image" parameter. You can add other parameters by amending the properties of the applet (by right-clicking the applet in the editor view and then choosing "Applet properties"). For a full list of the parameters that can be used, see below.

Using lake in a web page (HTML editors)

To include lake in a web page, you should copy all class files into the same directory as the web page and then insert an <APPLET...> tag into the page, e.g.


<applet code="lake" width= height=>
  <param name="image" value="sunset.jpg"> 
  <param name="href" 
    value="http://www.demon.co.uk/davidg/spigots.htm"> 
</applet>

Each of the "PARAM" tags passes a value to the applet. The examples shown here are the "image" parameter and the "href" parameter. In general the "PARAM" tag has the following format:


<PARAM name="[PARAMETER NAME]" value="[PARAMETER VALUE]">

Note that in Communicator 4.5 you will need to insert the tags in one at a time. Do this by choosing "Insert/HTML Tag..." from the menu for the <applet...> tag, then each of the <param...> tags and so on. For a full list of the parameters that can be passed to lake, see below.

Parameters that can be passed to lake

The following parameters can be passed to the lake:

The IMAGE parameter

JPG or GIF file that you want to reflect.


<applet code=lake width=250 height=250>
<param name=image value="scenic.jpg">
</applet>

The OVERLAY parameter

The JPG or GIF file that you want to appear over the animated image. Quite frequently an overlay would be a GIF file, so that parts of it can be made transparent and allow the lake image to show through.


<applet code=lake width=250 height=250>
<param name=image value="scenic.jpg">
<param name=overlay value="dglogo.gif">
</applet>

The HORIZON parameter

The HORIZON parameter allows you to have a visual horizon within the image. This is useful in situations where the image already has water and a horizon in it. In this example the original example is placed next to the lake version. Notice how the applet is exactly the same size as the original image. This is because it is animating part of the image, rather than reflecting it.


<img src="horizon.jpg" width=250 height=183 align=left>
<applet code=lake width=250 height=183>
<param name=image value="horizon.jpg">
<param name=horizon value="96">
</applet>

The HREF parameter

The URL to link to when the applet is clicked. By default this is http://www.demon.co.uk/davidg.


<applet code=lake width=250 height=250>
<param name=image value="scenic.jpg">
<param name=href value="http://www.javasoft.com">
</applet>

The TARGET parameter

This is the name of the frame you want any linked page to appear in.


<applet code=lake width=250 height=250>
<param name=image value="scenic.jpg">
<param name=href value="http://www.microsoft.com">
<param name=target value="newframe">
</applet>

The UNDERWATER parameter

TRUE if the image is to appear reflected on the underside of the water.


<applet code=lake width=250 height=250>
<param name=image value="scenic.jpg">
<param name=underwater value="true">
</applet>

The ROCKING parameter

Set to TRUE if you want the boat rocking.

If you set the "ROCKING" parameter to "TRUE" then you almost certainly need to reduce the height of the applet.


<applet code=lake width=250 height=220>
<param name=image value="scenic.jpg">
<param name=rocking value="true">
</applet>

Sizing and other matters

You will need to set the height of the applet by trial and error. Start off with the height equal to about 1.8 * height of original image. The only exception to this rule is if you are using the "Horizon" parameter, in which case you should set the image to the size of the image being used.

If you can still see a gap appearing at the bottom of the applet as the waves move backwards and forwards, then you should reduce the height a little.

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 exception.

Using it with JavaScript

How does the example applet above communicate with the images and controls around it?

Well for a start, if you are not using at least version 4 of Netscape or Internet Explorer, it won't be reacting at all. So if clicking on the images and the checkbox are either having no effect or producing an error, that will probably be the reason.

The HTML source for the above is:


<applet code=lake name=lake1 width=250 height=250>
<param name=image value="scenic.jpg">
<param name=href 
  value="http://www.demon.co.uk/davidg/spigots.htm">
</applet>

<form>
<img src="sunset_button.jpg" 
  onmouseup="lake1.setImageValue('sunset.jpg');">
<img src="city_button.jpg"
  onmouseup="lake1.setImageValue('city.jpg');">
<img src="scenic_button.jpg" 
  onmouseup="lake1.setImageValue('scenic.jpg');">
<img src="clouds_button.jpg"
  onmouseup="lake1.setImageValue('clouds.jpg');">
<br>
<input type=checkbox value="Rocking on" 
  onClick="lake1.toggleRocking();">Rocking
<br>
<input type=checkbox value="Underwater on" 
  onClick="lake1.toggleUnderwater();">Underwater
</form>

There are two important points to note in this code. Firstly, the <applet...> tag has been given a "name" attribute. Secondly, the different image and checkbox controls call methods as if the applet were a form or a text box on the web page. In fact the applet has become part of the browser's object model.

So - what are lake's methods?

setImageValue(var x)

setImageValue changes the image that is currently being reflected in the lake. The variable x should the name of a JPG or GIF file accessible by the applet.

setOverlayValue(var x)

setOverlayValue sets the filename of the overlay image.

setTargetValue(var x)

setTargetValue sets the target frame of the applet's "href" parameter.

setHRefValue(var x)

setHRefValue sets the hyperlink destination for when the applet is clicked.

setSpeedValue(var x)

setSpeedValue sets the animation speed (1 - 100).

setHorizonValue(var x)

setHorizonValue sets the level of the horizon (1 - height of image).

setRockingValue(var x)

setRockingValue sets whether the applet is rocking or not. The value passed should be either "true" or "false".

toggleRocking()

toggleRocking sets the rocking on and off alternately.

setUnderwaterValue(var x)

setUnderwaterValue sets whether the image is viewed from underwater or not. The value passed should be either "true" or "false".

toggleUnderwater()

toggleUnderwater sets underwater viewing on and off alternately.

Troubleshooting

Blank applet

If the applet remains blank 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.

Gap at the bottom

If you make the applet too large then you will notice a blank strip appear at the bottom of it as the waves lap backwards and forwards. The solution is to make the applet a bit smaller...

Positioning the horizon

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.

It's turned upside-down!

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 recommended. You can usually tell if a transparent GIF has been used because the top half of the applet will have parts which appear to be upside down.

Why won't the applet work off my hard disk?

Some web browsers have trouble opening applets straight from a hard disk. I have noticed this happen with Internet Explorer 3 and Netscape 4. Once you have loaded the class file and the web page onto your web site you should find it works OK.

Why does my web page say "Class Format Error"?

Class files are binary files, just like image files are. Binary files contain more information than text (also known as ASCII) files do. If you transfer class files as if they were ASCII files then they will lose this extra information and will become corrupted. How do you transfer class files as binary files? You should transfer them in the same way that you transfer image files.

Why does my web page say "Class Not Found"?

This is a very common problem. It may be because of one of the following:

  1. You have not put the class file onto the web site
  2. You are not calling the file with the correct name (rename to use the same combination of upper- and lower-case letters as your class file)
  3. Your transfer program has changed the name. This does happen. Some programs will shorten the ".class" extension to ".cla". Other will change the case of the letters to either all uppercase or all lowercase. See if you can change the options on the transfer program to stop it doing this.
  4. You have include a "codebase=…" clause inside your <applet…> code in your web page. "codebase=…" tells the browser to look some place else for the class file.
  5. Some other reason I haven't thought of :-)

Examples from the Web

The Lake Applet Ring
A terribly nice bloke by the name of Bruce Jodoin has started a "Lake applet ring" at http://viperspit.com/lake.html, to help provide links between lake sites on the web, as well as tutorials, a forum, some tea, a little sympathy and a lot advice for anyone having trouble getting it to work. He also has many, many, many lake examples.

Bruce's site is particularly recommended.

Tutorials
*. Paul Stephen's Web Site
Hereinafter known as the geezer. Paul gives a much much better tutorial than I do. Really worth a visit if you want to make the most out of lake.
*. Lakes by Aridelson Muller
Interesting tutorials including one about recreating accurately a painting by Caravaggio
*. Week Three Tutorial At the KrauseHouse
*. Ripply Effects in Java
Contains a tutorial by Andrew Bolt on how to use it. Andrew is also the inventor of Java string. Probably my favourite pointless Java applet.
*. http://www.vizitura.hu/javalake.htm
In Hungarian

Collections
*. Jason's Bryce Pages and Rick's Lake Applets
Rick Byington and his son Jason have created 78 lake applets, using photographs and Bryce 3D images.
*. Some Lake Applets
Wally O has created more lakes than the mind can comfortably imagine.
*. Lake effect examples upon classical art
Dan and Lorraine have create some very nice examples based upon Flemish and Italian paintings, which use Java script to change the images dynamically
*. Java Lake Applet Pages
I was pointed to this site by Bruce Jodoin. The Chapman's have spent a lot of time perfecting the use of overlays. If you want to see more examples of how to use this feature, this site is recommended.
*. Lake Images
*. The Classical Gallery
A beautiful sequence of pre-Raphaelite paintings by J. W. Waterhouse
*. Ann Cecil's Hawaiian Gallery
*. Musical Greeting Cards
*. The Walker Gallery
*. Lake Effects
*. Gus Hallgren's Site
Allegedly the world's largest collection of lakes. Also about the only person on the net to spell my surname correctly... :-) He has a particularly fine set of Ansel Adams photographs.
*. Novenas
The first of a series. For more information about the set, go to the main Novena page.
*. Adele's
Another HUGE collection of lakes
*. BowCreek Postcards
*. World at Our fingers lakes!
*. lake Applet Postcards
Where the gargoyles live
*. lake Effects
A sequence of lake images
*. http://www.aeol.com/brycestuff.html
Computer-generated rainbows 'n' stuff
*. http://www.angelfire.com/tx/mimms/mylakepics.html
One of many many many angel sites at angelfire
*. Stratton's Home Page
Canadian lake Scenes
*. Crossley lakes
Part of North Cross Designs
*. Laura Baker

Personal Home Pages
*. Ovarian Cancer Memorial
Memorial to Charlotte Faye Clark
*. Larry's Page
*. Lake Applets
Several lakes by Dianne Davies
*. The Lake Applet
Nice overlay effect to create a flowing river
*. Hide and Seek With Angels
Recommended
*. Daybreak
Particularly recommended. One of the most pleasing lake images I have seen. There is a second one which is possibly even better. Note especially the positioning of the fingers which appear to be touching the surface of the water.
*. Funlinks and Download
*. Brezi's Emporium
*. Lake Images - Links
Reflection of the comet Hale-Bopp.
*. ApplesHomepage
*. DiGregor Family Homepage
Clever use of the overlay.
*. Titanic
Mike Welch's animation of the famous White Star lubble bubble... gurgle.... splurt... :-)
*. hOme page
Nice use of colour.
*. DP's Famous Web Site
*. Lainey's 'No One But The Clown'
Part of her Artist's Hangout
*. Wolf's lake
By the artist Janet Fellows. See also Creation of Adam.
*. Southern Cybersoul
*. George Horiuchi's "Flame"
An interesting combination of the lake and Ripple applets
*. DAPeach's Home in the North Georgia Mountains
A nice wet rose
*. The Misseghers Homepage
Nice wooden frame effect
*. Earthrise
*. Wendy Rule
A singing witch, apparently. How very novel.
*. jacireann's Home Page
*. Addicted 2 MODS
*. Sunrise at Whitesbog
*. Cheathams Corner
*. Suwannee River
*. waseeka's Home Page
*. Sydney
'Struth Sheila. One from Oz. Talking of which, why not visit my very good friend Robin Haywood's web site?
*. April and Honey's Homepage
*. Vikki's Place
*. Georgia Boy

Places
*. Louisville Kentucky
Nice example of an overlay
*. Cuba's Official Web Site
Well I never....
*. Manor Inn - Yarmouth, Nova Scotia
Tastefully done
*. Portsmouth Virginia - Tourism
*. The City of Norfolk Virginia Official Web Site
Bit of competition between these two I think...
*. Lauderdale Isles Civic Improvement Association
*. Blackpool Council Homepage

Others
*. U.S.S. Archerfish
A lake image of the American submarine, complete with an animated flag.
*. C'Yuggah Sleeps
An example of the "Horizon" parameter
*. Sligo Bay Lifeboat
*. Chelmarsh Sailing Club
*. A.N.I.M.A.L
*. The Vikings
*. Jeziorak Lake
Nice example of an overlay
*. Avalon OnLine Guestbook
Another nice use of an overlay. Part of the Avalon official fanpage.
*. Boots & Yachtschulen Zimara
*. The USS Ranger Web Site
*. Tenkiller Marine Service
*. THAMES by Day and Night
*. CowPokin' Fun - Watson Water Wheel
*. Churchmead School
*. Shelton State Class Schedule
*. ArtPro Web Design
*. Die Zauberwald-Seite
*. Andy Art
Lots of free graphics as well
*. Wonderful World Of Java
*. March Object Oriented Pages
*. Photoshop Actions Archive - Action Addict V2.0
*. http://www.syrena.de/s_applet.htm
*. WDVL - The Java Universe
Opening image of the Web Developer's Library's most righteous site
*. Amateur Picture Gallery
*. ZMS World
*. Victims No More
*. Springtide Online '98
*. Wildlife-n-Wicks
*. Midi Mania
*. Bowen Island Historians

Linking to my site

If you use this applet then it would be nice if you gave me a link by copying the image:

(this is the file "dglogo.gif" in the .zip archive) into the same directory as your web page and then pasting the following into your page.


    <a href="http://www.spigots.com/spigots.htm" target="_top">
    <img src="dglogo.gif"
          width=88 height=31 border=0></a>

It will put a little button on your page that will link through to my Java Spigots page.

It is only a request: feel free to omit it.

Additional Usage Notes

There are additional notes available for this applet at The Lake Applet: Notes

Transferring files

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.

Contacting Me

If you still have trouble getting the applet to work and you have tried all of the possible solutions listed above, then feel to contact me, remembering to include:

1. A precise description of the problem (do you just get a grey rectangle, or an error message etc. etc.)
2. The URL of the page containing the applet (that's the actual page - not just the front page on your site)

These two pieces of information will make it a lot easier for me to solve the problem. I cannot guarantee that I will be able to respond to all messages (there's only so many hours in the day...) but sending the URL of a page that doesn't work will greatly increase the chances of getting an answer.

Remember to keep a look out at my web site for new applets.

David Griffiths,

25/11/1999



Privacy Statement
Created in Glorious Polyphonic HPL
Last updated: Thursday 25 November 1999