Androidberry logo Androidberry text logo
AndroidBerry Home
  • Learn Java
  • Java Programs
  • Interview Questions
  • Androidberry facebook
  • Androidberry twitter
  • Androidberry google plus

Java Tutorials


Basic Introduction

Decision Making

Looping

Classes and Objects

Inheritance

Interface

Packages

Exception Handling

Multithreading

Java Multithreading
Creating a Thread
Thread Life Cycle
Thread Exceptions
Thread Synchronization

Java Applets

What is Applet?
Java Applet vs Application
Creating a Applet
Displaying Applet on Webpage
Applet Lifecycle
Applet Tag
Passing Parameters to Applet
Setting Color to applet
Update and Repaint method
Using Fonts in Applet

Graphics Programming

Intro. to Graphics class
Drawing - Lines , Rectangles
Drawing - Circles and Ellipse
Drawing - Arcs
Drawing - Polygons
Drawing - Bar Charts

More on Java

Java Programs
Java Keywords Dictionary
Java Interview Questions

Java Applet Tag


Java HTML Applet Tag

The Applet tag gives the name of the applet to be loaded and tells the browser how much space the applet requires.

The applet tag starts from < applet> and ends with < /applet>

Required tag

Every java applet must have following minimum requirnment to display the applet on webpage.

<applet code ="FileName.class" 
         width =300
         height =100 >
</applet>

Applet Tag Complete Syntax

<applet
    codebase ="codepass-url"
    code ="AppletFileName.class"
    alt ="alternate-text"
    name ="applet-instance-name"
    width ="pixels"
    height ="pixels"
    align ="alignment"
    vspace="vertical space in pixels"
    hspace="horital space in pixels">
    
<param name ="name1" value="value1">
<param name ="name2" value ="value2">
....
....
 
</applet>

In above syntax except code,width and height all other parameters are not compulsary to write.

Syntax Description

Parameter Type Description
code AppletFileName.class It specifies the name of the applet class.
codebase codebase-url It specifies the URL of the directory in which the applet resides, if it exists in the same directory of HTML file, then neglect it.
Width pixels It specifies the width space on HTML page that will be reserved for applet
Height pixels It specifies the height space on HTML page that will be reserved for applet
Name applet-instance-name It is the name of the applet used for inter applet communication
ALIGN alignment It specifies where on the page the applet will appear.
TOP,BOTTOM,LEFT,RIGHT,MIDDLE,
ABSMIDDLE,ABSBOTTOM,TEXTTOP,BASELINE.
HSPACE pixels It specifies the amount of Horizontal black space the browser should leave surrounding the applet.
This is used only when ALIGN is set to LEFT or RIGHT.
VSPACE pixels This is used only when a vertical alignment is specified with ALIGN attribute.
It specifies the amount of vertical blank space the browser should leave surrounding the applet.
Alt alternate-text It is used to display text when applet is opened from non Java browser.

<< Previous Next >>

See Also

All Java Programs
Java Keywords
Java Interview Questions

AndroidBerry Support

About us
Contact us
Suggest us
Questions?

Follow us

Androidberry FacebookFacebook
Androidberry TwitterTwitter
Androidberry GooglePlusGoogle+
Back to top
Androidberry Name Logo