java
overview
Java differs from ActiveX in many ways, most of which are covered
in the ActiveX section. Java applets in web pages are generally
used for small multimedia effects that go beyond the standard
browser's HTML capabilities. For this tutorial, I'll show you how
to implement a Java applet using the <applet> and
<param> tags. For my sample applet, I've chosen an
interesting program written by Fab Le
Fantome: a twisted (pun intended) version of the normal 'ticker
tape' scroller.
the
<applet> tag
This is the code I used to display the applet above:
<applet code="Led.class" height=105 width=215> <param name="message" value=" THIS IS A TEST OF THE BENT LED APPLET - USED FOR THE WEBWORKS JAVA TUTORIAL - "> <param name="back_color" value="16777215"> <param name="back_image" value="bend.gif"> <param name="vDistortion" value=".85"> <param name="radius" value="88"> <param name="offX" value="14"> <param name="offY" value="9"> </applet>
This may look complicated, but it's actually very simple. First, the <applet> tag tells the browser the URL to the Java applet's code source, in this case, "Led.class". It also defines the height and width of the applet. Note that, although it may not make sense at first, the <applet> tag is a spanning tag. This is done for two reasons:
<applet code="myApplet.class" height=100 width=100> <p>Your browser does not support Java. Please download the latest version of Internet Explorer or Netscape.</p> </applet>
the
<param> tag
The other half of Java control implementation is the <param>
tag. Java controls expose a set of properties that affect how it
operates and displays. You can change these properties using the
<param> tag. In the above code, I used the <param> tag
to set up the background image, message properties, text, color,
and display options. It requires only two parameters:
Click here to go back to the table of contents.
Copyright © 1998 Webworks Team. All rights reserved. Email with questions or comments about this web site.