SlideShare a Scribd company logo
1 of 14
Download to read offline
Amir Shokri
2018
Present Title
“Applet”
Introduction
Applet are small java program primarily used for internet computing.
They can run using applet viewer or any web browser that supports java.
An Applet can perform arithmetic operation, display graphics, play sounds, accept user
input, create animation and play interactive games.
Local Applet ( store on local computer )
Remote Applet ( downloaded from remote computer and run locally ) ( the URL must be
specified in the CODEBASE value in html tag. )
Applet VS Application Program
Applet are not full featured application program. They are usually written to a accomplish a small
task or a component of a task. Since they are usually designed for use on the internet, they are
usually designed for use on the internet, they impose certain limitation and restrictions in their
design.
- Applets do not use the main() method for initiating the execution of the code. Applets, when
loaded automatically call certain methods of Applet class to start and execute the applet code.
- Unlike stand-alone applications, applets can not be run independently. They have to embedded
inside a web page to get using special feature known as HTML tag.
- Applets can only be executed inside the web browser of applet viewer.
Applet VS Application Program
- Applets can not read from or write to the files on the local computer.
- Applet can not communicate with the other servers on the network. Applet can not run any
program from the local computer.
- Applet are restricted from using libraries from other languages such as C or C++. ( java language
supports this feature through native methods )
Applet actually are of two types
1. One which use the AWT ( abstract window toolkit ) to draw and display graphics. ( Use Applet
class )
2. Another type which uses Swing for Drawing and Display of graphics ( use J Applet Class ). The
swing offers a richer and easer to use user interface the AWT. So swing based applet are more
popular then AWT based.
• But AWT based Applet are still used, especially when only a very simple user interface is
required.
• The JApplet class inherits the Applet Class, So all the methods of Applet Class are available in the
JApplet Class.
Writing Applet
• Building an applet code ( .java file )
• Creating an executable applet ( .class file )
• Designing a web page using HTML tags
• Writing an applet tag <APPLET>
• Adding <APPLET> tag into the web page
• Creating HTML file
• Testing the Applet Code
Building Applet Code
Import java.awt.*;
Import java.applet.*;
Public class test extends Applet
{
public void paint(Graphics gr)
{
// Instructions
}
}
Chain of classes inherited by Applet class
Java.lang.Object Java.awt.Component Java.awt.container Java.awt.Panel Java.applet.Applet
Applet Life cycle
Born
Running
Idle
Dead
Applet states
Initialization state : Applet Enters The initialization state when it is first loaded. It calls init
method of Applet class. The initialization occurs only once in the applet’s life cycle. we can
override the init method as
Public void init() { … }
Running State : Applet enters the running state when the system calls the start method of
Applet Class from born state or Idle State. The start method is automatically called when
we return back to the web page after leaving it. We can override the start method as
Public void start() { … }
Applet states
Stopped State / Idle State : An applet become idle when it is stopped from running. The stop method
is automatically called when we leave the web page. We can override the stop method as
Public void stop(){ … }
Dead State : An applet is said the be dead when it is removed from memory. This occurs
automatically by invoking the destroy() method when we quit the browser. The destroying state
occurs only once ( same as init() ). We can override the destroy method to clean up these resources:
Public void destroy() { … }
Applet states
Display State : applet moves to display state whenever it has to perform some output
operation on the screen. This happen immediately after the applet enters into the running
state. The paint() method is used for this. We must overriding this method if we want
anything to be displayed on screen.
Public void paint(Graphics gr) { … }
The display state is not actually the part pf applet’s life cycle. The paint method is inherited from the
Component class, a super class of Applet
You can get this presentation from slideshare;
Slideshare link : https://goo.gl/9CaVPj

More Related Content

What's hot (20)

Java Applets
Java AppletsJava Applets
Java Applets
 
applet using java
applet using javaapplet using java
applet using java
 
Java applets
Java appletsJava applets
Java applets
 
Java applets
Java appletsJava applets
Java applets
 
Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programming
 
Java applet
Java appletJava applet
Java applet
 
Applet progming
Applet progmingApplet progming
Applet progming
 
Applets in Java
Applets in JavaApplets in Java
Applets in Java
 
Java applets
Java appletsJava applets
Java applets
 
6.applet programming in java
6.applet programming in java6.applet programming in java
6.applet programming in java
 
Applet in java
Applet in javaApplet in java
Applet in java
 
Java applet basics
Java applet basicsJava applet basics
Java applet basics
 
Applet life cycle
Applet life cycleApplet life cycle
Applet life cycle
 
JAVA APPLETS
JAVA APPLETSJAVA APPLETS
JAVA APPLETS
 
java Applet Introduction
java Applet Introductionjava Applet Introduction
java Applet Introduction
 
first-applet
first-appletfirst-applet
first-applet
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
 
Appl clas nd architect.56
Appl clas nd architect.56Appl clas nd architect.56
Appl clas nd architect.56
 
Java Applet
Java AppletJava Applet
Java Applet
 
Java applet
Java appletJava applet
Java applet
 

Similar to Applet

Similar to Applet (20)

Applet (1)
Applet (1)Applet (1)
Applet (1)
 
Slide8appletv2 091028110313-phpapp01
Slide8appletv2 091028110313-phpapp01Slide8appletv2 091028110313-phpapp01
Slide8appletv2 091028110313-phpapp01
 
Oops
OopsOops
Oops
 
Java: Java Applets
Java: Java AppletsJava: Java Applets
Java: Java Applets
 
applet.pptx
applet.pptxapplet.pptx
applet.pptx
 
Java applet
Java appletJava applet
Java applet
 
Basic of Applet
Basic of AppletBasic of Applet
Basic of Applet
 
UNIT-1-AJAVA.pdf
UNIT-1-AJAVA.pdfUNIT-1-AJAVA.pdf
UNIT-1-AJAVA.pdf
 
Unit 7 Java
Unit 7 JavaUnit 7 Java
Unit 7 Java
 
Appletjava
AppletjavaAppletjava
Appletjava
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programming
 
Applet in java new
Applet in java newApplet in java new
Applet in java new
 
Lecture1 oopj
Lecture1 oopjLecture1 oopj
Lecture1 oopj
 
Advanced Programming, Java Programming, Applets.ppt
Advanced Programming, Java Programming, Applets.pptAdvanced Programming, Java Programming, Applets.ppt
Advanced Programming, Java Programming, Applets.ppt
 
Java files and io streams
Java files and io streamsJava files and io streams
Java files and io streams
 
Applet
AppletApplet
Applet
 
Applets
AppletsApplets
Applets
 
Applet programming1
Applet programming1Applet programming1
Applet programming1
 
oops with java modules iii & iv.pptx
oops with java modules iii & iv.pptxoops with java modules iii & iv.pptx
oops with java modules iii & iv.pptx
 
Java Applet
Java AppletJava Applet
Java Applet
 

More from Amir Shokri

LAUNCH - growth practices - PRODUCT MANAGER
LAUNCH - growth practices - PRODUCT MANAGERLAUNCH - growth practices - PRODUCT MANAGER
LAUNCH - growth practices - PRODUCT MANAGERAmir Shokri
 
Project Management Growth Practices
Project Management Growth PracticesProject Management Growth Practices
Project Management Growth PracticesAmir Shokri
 
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7Amir Shokri
 
Numbers, math operation, converting bases
Numbers, math operation, converting basesNumbers, math operation, converting bases
Numbers, math operation, converting basesAmir Shokri
 
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4Amir Shokri
 
review of image memorability methods
review of image memorability methodsreview of image memorability methods
review of image memorability methodsAmir Shokri
 
beyesian learning exercises
beyesian learning exercisesbeyesian learning exercises
beyesian learning exercisesAmir Shokri
 
Bayesian learning
Bayesian learningBayesian learning
Bayesian learningAmir Shokri
 
machine learning code
machine learning codemachine learning code
machine learning codeAmir Shokri
 
machine learning - id3, find-s, candidate elimination, desicion tree example
machine learning - id3, find-s, candidate elimination, desicion tree examplemachine learning - id3, find-s, candidate elimination, desicion tree example
machine learning - id3, find-s, candidate elimination, desicion tree exampleAmir Shokri
 
Concept learning
Concept learningConcept learning
Concept learningAmir Shokri
 
logical operators decision tree
logical operators decision treelogical operators decision tree
logical operators decision treeAmir Shokri
 
Mining social network graphs - persian
Mining social network graphs - persianMining social network graphs - persian
Mining social network graphs - persianAmir Shokri
 
product glossary
product glossaryproduct glossary
product glossaryAmir Shokri
 
Popular Maple codes Book - Persian
Popular Maple codes Book - PersianPopular Maple codes Book - Persian
Popular Maple codes Book - PersianAmir Shokri
 

More from Amir Shokri (20)

LAUNCH - growth practices - PRODUCT MANAGER
LAUNCH - growth practices - PRODUCT MANAGERLAUNCH - growth practices - PRODUCT MANAGER
LAUNCH - growth practices - PRODUCT MANAGER
 
Remote work
Remote workRemote work
Remote work
 
Project Management Growth Practices
Project Management Growth PracticesProject Management Growth Practices
Project Management Growth Practices
 
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7
 
Numbers, math operation, converting bases
Numbers, math operation, converting basesNumbers, math operation, converting bases
Numbers, math operation, converting bases
 
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4
 
review of image memorability methods
review of image memorability methodsreview of image memorability methods
review of image memorability methods
 
key.net
key.netkey.net
key.net
 
beyesian learning exercises
beyesian learning exercisesbeyesian learning exercises
beyesian learning exercises
 
Knn
KnnKnn
Knn
 
Bayesian learning
Bayesian learningBayesian learning
Bayesian learning
 
machine learning code
machine learning codemachine learning code
machine learning code
 
machine learning - id3, find-s, candidate elimination, desicion tree example
machine learning - id3, find-s, candidate elimination, desicion tree examplemachine learning - id3, find-s, candidate elimination, desicion tree example
machine learning - id3, find-s, candidate elimination, desicion tree example
 
ID3 Algorithm
ID3 AlgorithmID3 Algorithm
ID3 Algorithm
 
Concept learning
Concept learningConcept learning
Concept learning
 
logical operators decision tree
logical operators decision treelogical operators decision tree
logical operators decision tree
 
Matplotlib
MatplotlibMatplotlib
Matplotlib
 
Mining social network graphs - persian
Mining social network graphs - persianMining social network graphs - persian
Mining social network graphs - persian
 
product glossary
product glossaryproduct glossary
product glossary
 
Popular Maple codes Book - Persian
Popular Maple codes Book - PersianPopular Maple codes Book - Persian
Popular Maple codes Book - Persian
 

Recently uploaded

Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 

Recently uploaded (20)

Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 

Applet

  • 3. Introduction Applet are small java program primarily used for internet computing. They can run using applet viewer or any web browser that supports java. An Applet can perform arithmetic operation, display graphics, play sounds, accept user input, create animation and play interactive games. Local Applet ( store on local computer ) Remote Applet ( downloaded from remote computer and run locally ) ( the URL must be specified in the CODEBASE value in html tag. )
  • 4. Applet VS Application Program Applet are not full featured application program. They are usually written to a accomplish a small task or a component of a task. Since they are usually designed for use on the internet, they are usually designed for use on the internet, they impose certain limitation and restrictions in their design. - Applets do not use the main() method for initiating the execution of the code. Applets, when loaded automatically call certain methods of Applet class to start and execute the applet code. - Unlike stand-alone applications, applets can not be run independently. They have to embedded inside a web page to get using special feature known as HTML tag. - Applets can only be executed inside the web browser of applet viewer.
  • 5. Applet VS Application Program - Applets can not read from or write to the files on the local computer. - Applet can not communicate with the other servers on the network. Applet can not run any program from the local computer. - Applet are restricted from using libraries from other languages such as C or C++. ( java language supports this feature through native methods )
  • 6. Applet actually are of two types 1. One which use the AWT ( abstract window toolkit ) to draw and display graphics. ( Use Applet class ) 2. Another type which uses Swing for Drawing and Display of graphics ( use J Applet Class ). The swing offers a richer and easer to use user interface the AWT. So swing based applet are more popular then AWT based. • But AWT based Applet are still used, especially when only a very simple user interface is required. • The JApplet class inherits the Applet Class, So all the methods of Applet Class are available in the JApplet Class.
  • 7. Writing Applet • Building an applet code ( .java file ) • Creating an executable applet ( .class file ) • Designing a web page using HTML tags • Writing an applet tag <APPLET> • Adding <APPLET> tag into the web page • Creating HTML file • Testing the Applet Code
  • 8. Building Applet Code Import java.awt.*; Import java.applet.*; Public class test extends Applet { public void paint(Graphics gr) { // Instructions } }
  • 9. Chain of classes inherited by Applet class Java.lang.Object Java.awt.Component Java.awt.container Java.awt.Panel Java.applet.Applet
  • 11. Applet states Initialization state : Applet Enters The initialization state when it is first loaded. It calls init method of Applet class. The initialization occurs only once in the applet’s life cycle. we can override the init method as Public void init() { … } Running State : Applet enters the running state when the system calls the start method of Applet Class from born state or Idle State. The start method is automatically called when we return back to the web page after leaving it. We can override the start method as Public void start() { … }
  • 12. Applet states Stopped State / Idle State : An applet become idle when it is stopped from running. The stop method is automatically called when we leave the web page. We can override the stop method as Public void stop(){ … } Dead State : An applet is said the be dead when it is removed from memory. This occurs automatically by invoking the destroy() method when we quit the browser. The destroying state occurs only once ( same as init() ). We can override the destroy method to clean up these resources: Public void destroy() { … }
  • 13. Applet states Display State : applet moves to display state whenever it has to perform some output operation on the screen. This happen immediately after the applet enters into the running state. The paint() method is used for this. We must overriding this method if we want anything to be displayed on screen. Public void paint(Graphics gr) { … } The display state is not actually the part pf applet’s life cycle. The paint method is inherited from the Component class, a super class of Applet
  • 14. You can get this presentation from slideshare; Slideshare link : https://goo.gl/9CaVPj