HTML and CSS Reference
In-Depth Information
Applets are embedded within Web pages just like the sound and video clips you
embedded in the first two sessions of this tutorial. The applet runs within an applet win-
dow, which can be resized and positioned anywhere within the page.
Libraries of Java applets are available on the Web. Some applets are free to download
and use for non-commercial purposes. In other cases, programmers charge a fee for the
use of their applets. You can find Java applets for a variety of tasks, including stock mar-
ket tickers, games, animations, and utilities for your browser or Web page. The popularity
of Java has declined in recent years as more and more of its features can be duplicated
with Flash or JavaScript. The programming enhancements provided with HTML5 also
will result in an even more reduced need for Java. However, for the moment, Maxine still
wants to use a Java applet with her sample page.
Working with Java Applets
Java applets are embedded with the same object element you used in the last session to
embed a Flash player. The general syntax of an embedded Java applet is
<object type=”application/x-java-applet”
width=” value ” height=” value ”>
<param name=”code” value=” url ” />
parameters
</object>
where the width and height attributes define the dimensions of the applet window, url
specifies the location and filename of the Java file (usually the class file), and parameters
represents the parameters associated with running the applet.
Embedding a Java Applet
Maxine has located a Java applet to display text in a scrolling marquee. The name of the
class file is CreditRoll.class . You'll embed this applet in her Web page both as an ActiveX
object for Internet Explorer and as a plug-in for non-IE browsers.
Embedding a Java Applet
• To embed a Java applet, use the object element
<object type=”application/x-java-applet”
width=” value ” height=” value ”>
<param name=”code” value=” url ” />
parameters
</object>
where the width and height attributes define the dimensions of the applet window,
url specifies the location and filename of the Java file (usually the class file), and
parameters represents the parameters associated with running the applet.
Search WWH ::




Custom Search