Banner Applet cum Application

More attributes of <applet> tag

We know to run an applet, a HTML file is required. The applet is included in the HTML file with <applet> tag. When the user clicks over the hyperlink on a Web page, the server downloads the applet onto the client machine. The browser executes the applet. For this, the browser should come with JVM. Of course, now-a-days, majority of browsers come with JVM by default. The browsers with JVM are known as Java enabled browsers. Browser does not require a compiler as compiled applet file is given to browser to execute.

We used earlier, only code, width and height attributes of <applet> tag, but <applet> tag comes with many more attributes. Total attributes are summarized as here under.

Mandatory attributes

  1. code: Here, we write the name of the applet that should be loaded by the browser.
  2. width: This attribute gives the width of the applet window in pixels
  3. height: This attribute gives the height of the applet window in pixels

Optional attributes

  1. codebase: Generally, the html file and the applet file exist in the same folder or JAR file. If the applet file exist in a different folder, then the address of he applet is given with this attribute.
  2. alt: Stands for alternative text. If the browser is unable to display the applet for some reason, then the text of the alt is displayed.
  3. vspace: It gives the vertical space between the applet window and the surrounding the text in the browser.
  4. hspace: It gives the horizontal space between the applet window and the surrounding the text in the browser.

The <applet> tag may contain an optional following child tag.

<param name="firstNum" value="18">

The <param> takes a key/value pair. This tag data is used to initialize the applet with some default properties.

An <applet> tag with all the attributes looks as follows.

<applet
code="Move.class"
codebase="d:\jyostna"
vspace = "40"
hspace = "60"
alt = "Cyber Towers building not displayed" >

<param name="distance" value="20">
</applet>

2 thoughts on “Banner Applet cum Application”

  1. Well, i created a banner and a choose menu and also radio buttons in one program but the banner and choose menu are overlapping each other… how do i change the position of the moving banner?

Leave a Comment

Your email address will not be published.