Displaying Applets


  • Applets begin execution via the loading of a HTML page "containing them"

  • Either the appletviewer or a Web browser is required to run Applets

  • Browser detects an Applet by processing an <Applet> HTML tag

  • The HTML tag syntax is:

    <APPLET CODE="..." 
    WIDTH="..." HEIGHT="..."
    [CODEBASE="..."
    ALT="..." NAME="..."
    ALIGN=left | right | top |
    VSPACE="..." HSPACE="..." ]>

    [<PARAM NAME="..." VALUE="...">]

    [Text for non-Java supporting browsers]

    </APPLET >


Detailed Description:

"Again, it follows the standard hypertext markup language (HTML) syntax. The syntax is a less than sign ([<) followed by APPLET, which can be in any case, followed by CODE= and the name of your Java applet. In this case, it would be your byte code file. Typically, it would be some filename.class. Two more required parameters, WIDTH= and HEIGHT= represents the height and width in pixels within your web page where the Java applet will execute and display its information. Those are the required parameters for the applet tag. Between the APPLET tag and the /APPLET tag, there are any number of PARAM tags. This is the way you pass in parameters that control the execution of your applet. Most well-built applets will take in several parameters to set the necessary configuration for the applet to run on your web page. A PARAM tag has the following keyword/value syntax: you specify NAME= and a string for the name followed by VALUE= and the value you wish to associate with that name. Again, any number of PARAM tags can be specified. Between the PARAM tags and the /APPLET tag (that indicates the end of the applet) you can put text that is displayed by non-Java- enabled browser. That's a browser that doesn't understand the APPLET tag."