Asked by:
applet

Question
-
In the java what is the use of applet and how it is createdThursday, October 4, 2007 8:25 AM
All replies
-
Using the APPLET TagThis section tells you most of what you need to know to use the
<APPLET>
tag. It starts by showing you the tag's simplest form. It then discusses some of the most common additions to that simple form: the<PARAM>
tag, alternate HTML code and text, theCODEBASE
attribute, and theARCHIVE
attribute. For a detailed description of the<APPLET>
tag, refer to Using the applet Tag.You should already have seen the simplest form of the
<APPLET>
tag:This tag tells the browser to load the applet whose<APPLET CODE=AppletSubclass.class WIDTH=anInt HEIGHT=anInt> </APPLET>
Applet
subclass is named AppletSubclass, displaying it in an area of the specified width and height.Specifying Parameters
Some applets let the user customize the applet's configuration with parameters, as described in Defining and Using Applet Parameters. For example,AppletButton
(an applet used throughout this tutorial to provide a button that brings up a window) allows the user to set the button's text by specifying the value of a parameter namedBUTTONTEXT
.The developer provides the value of a parameter using a
<PARAM>
tag. The<PARAM>
tags should appear just after the<APPLET>
tag for the applet they affect:<APPLET CODE=AppletSubclass.class WIDTH=anInt HEIGHT=anInt> <PARAM NAME=parameter1Name VALUE=aValue> <PARAM NAME=parameter2Name VALUE=anotherValue> </APPLET>
Here's an example of the
<PARAM>
tag in use.<APPLET CODE="Animator.class" WIDTH=460 HEIGHT=160> <PARAM NAME="imageSource" VALUE="images/Beans"> <PARAM NAME="backgroundColor" VALUE="0xc0c0c0"> <PARAM NAME="endImage" VALUE=10> <PARAM NAME="soundSource" VALUE="audio"> <PARAM NAME="soundtrack" VALUE="spacemusic.au"> <PARAM NAME="sounds" VALUE="1.au|2.au|3.au|4.au|5.au|6.au|7.au|8au|9.au|0.au"> <PARAM NAME="pause" VALUE=200> . . . </APPLET>
Specifying Alternate HTML Code and Text
Note the ellipsis points (". . .") in the previous HTML example. What did the example leave out? It omitted alternate HTML code — HTML code interpreted only by browsers that don't understand the<APPLET>
tag. Alternate HTML code is any text that appears between the<APPLET>
and</APPLET>
tags, after any<PARAM>
tags. Browsers enabled with Java technology ignore alternate HTML code.To specify alternate text to browsers enabled with Java technology and other browsers that understand the
<APPLET>
tag, use theALT
attribute. If the browser can't display an applet for some reason, it can display the applet'sALT
text.We use alternate HTML code throughout the online version of this tutorial to tell readers about the applets they're missing. Often, the alternate HTML code includes one or more pictures of the applet. Here's the complete HTML code for the
Animator
example shown previously:A browser that does not understand the<APPLET CODE="Animator.class" WIDTH=460 HEIGHT=160 ALT="If you could run this applet, you'd see some animation"> <PARAM NAME="imageSource" VALUE="images/Beans"> <PARAM NAME="backgroundColor" VALUE="0xc0c0c0"> <PARAM NAME="endImage" VALUE=10> <PARAM NAME="soundSource" VALUE="audio"> <PARAM NAME="soundtrack" VALUE="spacemusic.au"> <PARAM NAME="sounds" VALUE="1.au|2.au|3.au|4.au|5.au|6.au|7.au|8au|9.au|0.au"> <PARAM NAME="pause" VALUE=200> Your browser is completely ignoring the <APPLET> tag! </APPLET>
<APPLET>
tag ignores everything in the previous HTML code except the line that starts with "Your". A browser that does understand the<APPLET>
tag ignores everything on that line. If the applet-savvy browser can't run the applet, it might display theALT
text.Friday, October 5, 2007 1:53 AM -
hi the use of applet is 2 write coding in dhtml coding in java n its is created in java class is 2 extend in applet class...Friday, October 5, 2007 9:13 AM -
small Java- and JavaScript-based Web application. Applets can display animation, perform database queries, or make other Web page enhancements...! Java programs that are run from the browser are always known as applets.. It can be created by just embedding he java applet code in the Html File As Follows ...::
Code Block<Html>
<Body><Applet Code="MyApplet.class" width=200 Height=100>
</Applet></Body>
</Html>
Sunday, October 7, 2007 2:26 AM