Java on the Web relies on programs called applets. These are stored in .class files these are linked & set up to a webpage by a set of HTML tags.
Now writing actual applets is beyond the scope of this basic guide, but setting up applets isn't difficult (you'll just need to add few lines of HTML code which effectively set up a link to the applet just in the same way you add graphics to your pages)
You can get tons of applets on the web for free. Usually you'll get a read me document telling you how to set them up and what you need to add to your page. Like all things from the web be careful & use a reliable Java site to get you applets from (potentially you can create a virus like applet that could damage someone's computer if run)
Let's use an example to show you how easy it is to add them (this one was created
by Sun Microsystems)
The source. (Click for copyright and precise Java info)
This runs from an applet called NervousText.class
What we need to do is add the following lines of HTML & text to the page
<applet code="NervousText.class" width=375 height=50> <param name=text value="Leaping text !!!!"> Sorry you need a Java enabled browser to see this </applet>
The first line sets up the link to our .class applet file and defines the size of the Java box on the page (in pixels).
The second line <param ...> allows us to define attributes (i.e. parameters) of the applets action. These can be complex and varied or simple like here where the command simply tells the applet what text to display. Most applets will require several <param> tags to be set
The 3rd line is just a text line for non Java enabled browsers
And the final line </applet> just closes off the applet
It's not difficult to add the applet, but you'll have to add it in the form of direct HTML coding
The first is to use the insert HTML option from the menu as described elsewhere on this site
If using Netscape 6.x composer you would just enter all 4 lines if setting up the applet.
Earlier versions need to enter the lines separately. You'd enter the first 2 lines in this method but then you'd just type in the text (3rd) line after the 2 HTML tag signs directly on the composer window before entering the lastline via the HTML method
There are plenty of sources of info on writing Java in print and online. Check out our links or our reviews