Java applets are a good way of making your web pages look more interesting. Use them sparingly though because they can take a while to load and initialise. Anyway, here's how to use them. In your HTML source put something similar to the following. I'll explain it all later.

<APPLET CODE="display.class" WIDTH=100 HEIGHT=100>
<PARAM NAME="text" VALUE="Hello!">
<PARAM NAME="colour" VALUE="Black">
</APPLET>

The above example will execute an applet called display with width and height both 100. All you have to do is replace display.class with whatever your applet is called. To pass parameters to the applet you use the <PARAM> tag. You then use the NAME attribute to specify which parameter you want to set and the VALUE attribute to give it a value. The above example will set the text parameter to "Hello!" and the colour parameter to "Black".

All my applets take hexadecimal triplets for colour values. These are in the form of a string. So, three comma separated numbers, enclosed in brackets, with no spaces in between. The numbers must be between 0 and 255 inclusive. The first number is red, the second green, and the third blue. So, if you wanted black you would have to write "0,0,0" and for white, "255,255,255". That's about all there is to it.


Copyright ©1999 Mark Ogden (webmaster@poggy.globalnet.co.uk)