Monday, January 2, 2012

How to Running Java Applets?


Running Java Applets 
To use an applet with your web page, you add tags to the web page and place the class file (the applet file) on your web site, usually in the same directory as your web pages. Originally, Java applets were enclosed in and tags, but more recent versions of HTML require applets to appear within and tags.
Here is an example of one way the code is often written, using a hypothetical applet called sitemap.class that creates a graphical image displaying a table of contents (site map) for your web site:
 

 


Within the tag, the CODETYPE attribute is optional, but helps browsers that are not Java-enabled to avoid downloading the applet. The CLASSID attribute is required because it specifies the applet filename (sitemap.class in this example). The WIDTH and HEIGHT attributes are optional, but are usually included to give the dimensions (in pixels) of the area of the page where the applet is allowed to write.
The tag can also include the following optional attributes:
CODE BASE The URL where the applet file resides, if it is not in
the same directory as the web page
ALIGN Horizontal alignment; for example, center
VSP ACE and HSP ACE The vertical and horizontal white space, respectively, around the applet's writing area  ALT Alternate text that appears if the browser can't process the applet
Most applets allow the page developer to choose details about how the applet operates. You give those details by using tags that contain NAME and VALUE attributes. Depending on the applet, you may need no
tags or you may need many. In the preceding example, the web page developer has set three parameters named bgcolor (background color), font, and url to various values. You must read the applet's documentation to know how to set its parameters. 

 
Design by Free Wordpress Themes | Bloggerized by Lasantha - Premium Blogger Templates