0% found this document useful (0 votes)
3 views8 pages

Applet

Applet easy to learn. Dynamic

Uploaded by

dwivedibhumi5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views8 pages

Applet

Applet easy to learn. Dynamic

Uploaded by

dwivedibhumi5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

What is Applet???

 Applets are small applications that are accessed on an


Internet server, transported over the Internet, automatically
installed, and run as part of a Web document.

 An Applet is a JAVA program that can be embedded into


HTMl page.
ADVANTAGES OF APPLET

 CrossplatformandcanrunonWindows,MacOSandLinuxplatform.
 Appletcanworkalltheversion ofJAVAplugin.
 Applertsruninasandbox.
 Appletsaresupportedbymostwebbrowsers.
 Appletsareacachedinmostwebbrowsers.
DISADVANTAGES OF APPLET

 JAVApluginis requiredtorunApplet.
 JavaAppletrequires JVM.
IfAppletis notalready cachedinmachine,itwillbedownloadedfrominternetandwill
taketime.
Itis difficulttodesignandbuildgooduserinterfaceinAppletscomparedtoHTML
technology.
LIFECYCLEOF AN APPLET

• Applets life cycle includes the following methods :


• 1. Init( )
• 2. Start( )
• 3. Paint( )
• 4. Stop( )
• 5. Destroy( )
• init():Is usedtoinitializedtheapplet.Itis invokedonlyonce.
• start():Is invokedaftertheinit() methodor browser is maximized.It is usedtostart
theapplet.
• paint(graphicsg):is usedtopainttheapplet.Itprovidesgraphicsclassobjectthat
canbeusedfordrawingoval,rectangle,arcetc.
• stop():Is usedtostoptheapplet.Itis invokedwhenappletis stoporbrowseris
minimized.
• destroy(): Is usedtodestroytheapplet.Itis invokedonlyonce.
TYPESOF APPLETS

•Appletsaretwotypes:
1.Simpleapplets
• simpleappletscanbecreatedbyextendingappletclass

2.Japplets
• jappletscanbecreatedbyextendingjappletclassofjavax.Swing.Jappletpackage
CREATING APPLETS
● Appletsarecreatedbyextendingtheappletclass:
// SavefileasHelloWorld.java
importjava.applet.Applet;
importjava.awt.Graphics;

publicclass HelloWorldextendsApplet{
publicvoidpaint(Graphics g){

g.drawString("HelloWorld",20,20);}}

<appletcode="HelloWorld" width=200height=60>
</applet>

You might also like