Contents    Previous    Next

The APP HTML Tag

To add an applet to an HTML page, you need to use the APP HTML tag. This page discusses the general syntax of this tag. Examples of its use are elsewhere in this document.

The general syntax of the APP HTML tag:

    <APP CLASS="ClassName"
         SRC="URL"
         ALIGN=alignment
         WIDTH=widthInPixels
         HEIGHT=heightInPixels
         AppletSpecificAttribute=aValue
         ...>
CLASS, SRC, and so on are attributes; they give HotJava information about the applet. The only mandatory attribute is CLASS. The rest of this page discusses the values each attribute can have.
ClassName
is the name of an applet (either written by you or provided to you). This name is the name of the Applet subclass. For example, if you write an Applet subclass named MyApplet, then to include it in an HTML page you should specify:
    CLASS="MyApplet"

URL
specifies the directory (folder) containing the classes directory that contains the compiled Applet subclass. (If the Applet subclass is named MyApplet, then its compiled file is named MyApplet.class.) If you don't specify this attribute, HotJava looks for the ".class" file in the classes directory under the directory that the HTML file containing the APP tag is in. To specify one of the applets provided in this release, use:
    SRC="doc:/demo/"
Note: You must include the final slash ("/").

alignment
is a way to specify how the applet's image should be aligned with the text that follows. If you don't specify this attribute, then the bottom of the applet's image is aligned with the following text. If you specify ALIGN=TOP, then adjacent text is aligned with the top of the image. Specify ALIGN=MIDDLE to align the text with the center of the image.

widthInPixels and heightInPixels
are hints to the browser indicating how much space the applet will require. HotJava uses these to lay out the page properly while it's waiting for the applet to draw itself.

AppletSpecificAttribute
is any attribute name the applet allows. The applet writer specifies what (if any) attributes the applet accepts. Some applets have no attributes; others might require that you specify several. For example, the ImageLoopItem applet has two applet-specific attributes: IMG and PAUSE.

aValue
is a string that should be enclosed in quotation marks (but doesn't necessarily have to be). The applet determines how to interpret this string.

Contents    Previous    Next