SlideShare a Scribd company logo
Programming Language (JAVA)
Unit 6.11 – Applets
Presentation 1
Revision
1. Explain exception handling in Java.
2. List the types of exceptions in Java
language.
3. What are try, catch and throw blocks
used for?
Objectives
At the end of this presentation, you will be able to :
• Explain applet programming
• List the differences between applications and
applets
• Describe the different stages in the life cycle of
an applet
Java Programs
Java supports two kinds of programs.
• Java Applications are the normal standalone
programs.
• Java Applets are the programs that are to be
embedded in a Web page.
Applet Programming
• Applets are the Java programs that are
executed by the Web browser.
• Appletviewer is a Java utility to execute
applets.
• Applet is a special class file written to display
graphics in a Web browser.
Applets
• Applets are embedded in Web pages using
the HTML tag <APPLET>.
• When a Web page containing applet program
is run, it is downloaded to the memory
automatically and executed by the Web
browser.
• Applet gets displayed in the specific space
allocated in the Web page called Applet
Window.
Applets
Applets can contain embedded objects like :
• Animated graphics
• Video games
• Advanced text displays and images
• Audio
Applet Types
• Local Applets

Applets that are stored in the local machine
• Remote Applets

Applets that are stored in a remote computer.

These can be downloaded and embedded into Web
pages from the Internet.
Local Applets
Remote Applets
Applets Vs. Applications
Applets Applications
Applets are embedded in
Web pages and cannot be
run independently.
Applications can be
run independently.
Applet programs call certain
methods such as init(),
start(), stop(), and destroy()
of Applet class to start and
execute the applet code.
Programs use the
main() method for
initiating the
execution of the
code.
Applets Vs. Applications (Contd..)
Applets Applications
Applets cannot read from or
write to the files in the local
computer.
Applications can
read from or write
to local computer.
Applets enable the user to
interact graphically.
Applications do not
enable the user to
interact graphically.
Life Cycle of Applets
The four methods executed are :
1. init()
2. start()
3. stop()
4. destroy()
Life Cycle of Applets
init()
Initialisation State
• This method is executed when it is first
loaded into the memory.
• The applet is now said to exist in the
initialisation state.
init()
Syntax
public void init( )
{
<action statements>;
}
start()
Running State
• The start() method of the Applet Class is
executed whenever an applet is started or
restarted.
• The applet is now said to exist in the running
state.
start()
Syntax
public void start()
{
<action statements>;
}
stop()
Idle State
• The stop() method is executed when an applet is
closed.
• The applet is stopped automatically when the user
switches to another program or Web page.
• This can also be done by invoking explicitly the
stop() method of Applet class.
• When this is invoked the applet enters the idle
state.
stop()
Syntax
public void stop( )
{
<action statements>;
}
destroy()
Dead State
• The destroy() method is executed when a
Web page is closed.
• The applet is now said to be in the dead
state.
destroy()
Syntax
public void destroy( )
{
<action statements>;
}
paint()
• The paint() method of the Applet class is
executed automatically whenever the applet
is displayed in the Web page.
• This method is used to draw graphics in the
drawing area of the applet.
repaint()
• The repaint() method is used whenever you
want to redraw the applet’s drawing area.
• The repaint() method calls the update()
method.
• The update() method clears the applet area
and calls the paint() method.
paint()
Syntax
public void paint(Graphics g)
{
<display statements>;
}
Summary
In this presentation, you learnt the following
• Applets are Java programs mainly used in
Internet computing.
• The applet’s output is displayed within a subset
of the display area of the browser.
• Java applet inherits a set of default properties
from the Applet class.
• An applet enters the Initialisation state when it is
first loaded.
Summary
In this presentation, you learnt the following
• Applet enters the running state when the start()
method of Applet class is invoked.
• An applet becomes idle when it is stopped from
running.
• An applet is said to be dead when it is removed
from memory.
Assignment
1. Define an applet. List the uses of applets.
2. Sketch and explain the life cycle of an
applet.

More Related Content

Similar to Java programming Java programming Java programming (20)

Slide8appletv2 091028110313-phpapp01
Slide8appletv2 091028110313-phpapp01Slide8appletv2 091028110313-phpapp01
Slide8appletv2 091028110313-phpapp01
Abhishek Khune
 
Lecture1 oopj
Lecture1 oopjLecture1 oopj
Lecture1 oopj
Dhairya Joshi
 
171-33B - Java Programming-Building Applets.ppt
171-33B - Java Programming-Building Applets.ppt171-33B - Java Programming-Building Applets.ppt
171-33B - Java Programming-Building Applets.ppt
BWUBTA21109
 
Advanced Programming, Java Programming, Applets.ppt
Advanced Programming, Java Programming, Applets.pptAdvanced Programming, Java Programming, Applets.ppt
Advanced Programming, Java Programming, Applets.ppt
miki304759
 
Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programming
mcanotes
 
Jsp applet
Jsp appletJsp applet
Jsp applet
Sanoj Kumar
 
3. applets
3. applets3. applets
3. applets
AnusAhmad
 
Applet.pptx
Applet.pptxApplet.pptx
Applet.pptx
LakachewYezihalem
 
Applets
AppletsApplets
Applets
Nuha Noor
 
Java: Java Applets
Java: Java AppletsJava: Java Applets
Java: Java Applets
Tareq Hasan
 
Java files and io streams
Java files and io streamsJava files and io streams
Java files and io streams
RubaNagarajan
 
Java Applet
Java AppletJava Applet
Java Applet
jalinder123
 
Applet ppt for higher understanding education
Applet ppt for higher understanding educationApplet ppt for higher understanding education
Applet ppt for higher understanding education
BhanuPriya93439
 
27 applet programming
27  applet programming27  applet programming
27 applet programming
Ravindra Rathore
 
JAVA APPLET BASICS
JAVA APPLET BASICSJAVA APPLET BASICS
JAVA APPLET BASICS
Shanid Malayil
 
Applet intro
Applet introApplet intro
Applet intro
Nitin Birari
 
java applets
java appletsjava applets
java applets
Waheed Warraich
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
Prof Ansari
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
Prof Ansari
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
amitksaha
 
Slide8appletv2 091028110313-phpapp01
Slide8appletv2 091028110313-phpapp01Slide8appletv2 091028110313-phpapp01
Slide8appletv2 091028110313-phpapp01
Abhishek Khune
 
171-33B - Java Programming-Building Applets.ppt
171-33B - Java Programming-Building Applets.ppt171-33B - Java Programming-Building Applets.ppt
171-33B - Java Programming-Building Applets.ppt
BWUBTA21109
 
Advanced Programming, Java Programming, Applets.ppt
Advanced Programming, Java Programming, Applets.pptAdvanced Programming, Java Programming, Applets.ppt
Advanced Programming, Java Programming, Applets.ppt
miki304759
 
Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programming
mcanotes
 
Java: Java Applets
Java: Java AppletsJava: Java Applets
Java: Java Applets
Tareq Hasan
 
Java files and io streams
Java files and io streamsJava files and io streams
Java files and io streams
RubaNagarajan
 
Applet ppt for higher understanding education
Applet ppt for higher understanding educationApplet ppt for higher understanding education
Applet ppt for higher understanding education
BhanuPriya93439
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
Prof Ansari
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
Prof Ansari
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
amitksaha
 

More from Fadlie Ahdon (6)

Degrees_Mot_wk3_updatwqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqed.ppt
Degrees_Mot_wk3_updatwqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqed.pptDegrees_Mot_wk3_updatwqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqed.ppt
Degrees_Mot_wk3_updatwqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqed.ppt
Fadlie Ahdon
 
Puisi-dan-Madah-Cinta-Melayu-Yearnings.pptx
Puisi-dan-Madah-Cinta-Melayu-Yearnings.pptxPuisi-dan-Madah-Cinta-Melayu-Yearnings.pptx
Puisi-dan-Madah-Cinta-Melayu-Yearnings.pptx
Fadlie Ahdon
 
Google Forms - Introduction to Googe form learning
Google Forms - Introduction to Googe form learningGoogle Forms - Introduction to Googe form learning
Google Forms - Introduction to Googe form learning
Fadlie Ahdon
 
Google Site.pdf
Google Site.pdfGoogle Site.pdf
Google Site.pdf
Fadlie Ahdon
 
CPPDS Slide.pdf
CPPDS Slide.pdfCPPDS Slide.pdf
CPPDS Slide.pdf
Fadlie Ahdon
 
Pembentangan ITARS2021
Pembentangan ITARS2021Pembentangan ITARS2021
Pembentangan ITARS2021
Fadlie Ahdon
 
Degrees_Mot_wk3_updatwqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqed.ppt
Degrees_Mot_wk3_updatwqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqed.pptDegrees_Mot_wk3_updatwqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqed.ppt
Degrees_Mot_wk3_updatwqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqed.ppt
Fadlie Ahdon
 
Puisi-dan-Madah-Cinta-Melayu-Yearnings.pptx
Puisi-dan-Madah-Cinta-Melayu-Yearnings.pptxPuisi-dan-Madah-Cinta-Melayu-Yearnings.pptx
Puisi-dan-Madah-Cinta-Melayu-Yearnings.pptx
Fadlie Ahdon
 
Google Forms - Introduction to Googe form learning
Google Forms - Introduction to Googe form learningGoogle Forms - Introduction to Googe form learning
Google Forms - Introduction to Googe form learning
Fadlie Ahdon
 
Pembentangan ITARS2021
Pembentangan ITARS2021Pembentangan ITARS2021
Pembentangan ITARS2021
Fadlie Ahdon
 
Ad

Recently uploaded (20)

Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptxRai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition OecdEnergy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxSEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
PoojaSen20
 
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 EmployeeHow to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 SalesHow to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
Strengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptxStrengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptx
SteffMusniQuiballo
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
Quiz Club of PSG College of Arts & Science
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18
Celine George
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition OecdEnergy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxSEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
PoojaSen20
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 EmployeeHow to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 SalesHow to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
Strengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptxStrengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptx
SteffMusniQuiballo
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18
Celine George
 
Ad

Java programming Java programming Java programming

  • 1. Programming Language (JAVA) Unit 6.11 – Applets Presentation 1
  • 2. Revision 1. Explain exception handling in Java. 2. List the types of exceptions in Java language. 3. What are try, catch and throw blocks used for?
  • 3. Objectives At the end of this presentation, you will be able to : • Explain applet programming • List the differences between applications and applets • Describe the different stages in the life cycle of an applet
  • 4. Java Programs Java supports two kinds of programs. • Java Applications are the normal standalone programs. • Java Applets are the programs that are to be embedded in a Web page.
  • 5. Applet Programming • Applets are the Java programs that are executed by the Web browser. • Appletviewer is a Java utility to execute applets. • Applet is a special class file written to display graphics in a Web browser.
  • 6. Applets • Applets are embedded in Web pages using the HTML tag <APPLET>. • When a Web page containing applet program is run, it is downloaded to the memory automatically and executed by the Web browser. • Applet gets displayed in the specific space allocated in the Web page called Applet Window.
  • 7. Applets Applets can contain embedded objects like : • Animated graphics • Video games • Advanced text displays and images • Audio
  • 8. Applet Types • Local Applets  Applets that are stored in the local machine • Remote Applets  Applets that are stored in a remote computer.  These can be downloaded and embedded into Web pages from the Internet.
  • 11. Applets Vs. Applications Applets Applications Applets are embedded in Web pages and cannot be run independently. Applications can be run independently. Applet programs call certain methods such as init(), start(), stop(), and destroy() of Applet class to start and execute the applet code. Programs use the main() method for initiating the execution of the code.
  • 12. Applets Vs. Applications (Contd..) Applets Applications Applets cannot read from or write to the files in the local computer. Applications can read from or write to local computer. Applets enable the user to interact graphically. Applications do not enable the user to interact graphically.
  • 13. Life Cycle of Applets The four methods executed are : 1. init() 2. start() 3. stop() 4. destroy()
  • 14. Life Cycle of Applets
  • 15. init() Initialisation State • This method is executed when it is first loaded into the memory. • The applet is now said to exist in the initialisation state.
  • 16. init() Syntax public void init( ) { <action statements>; }
  • 17. start() Running State • The start() method of the Applet Class is executed whenever an applet is started or restarted. • The applet is now said to exist in the running state.
  • 19. stop() Idle State • The stop() method is executed when an applet is closed. • The applet is stopped automatically when the user switches to another program or Web page. • This can also be done by invoking explicitly the stop() method of Applet class. • When this is invoked the applet enters the idle state.
  • 20. stop() Syntax public void stop( ) { <action statements>; }
  • 21. destroy() Dead State • The destroy() method is executed when a Web page is closed. • The applet is now said to be in the dead state.
  • 22. destroy() Syntax public void destroy( ) { <action statements>; }
  • 23. paint() • The paint() method of the Applet class is executed automatically whenever the applet is displayed in the Web page. • This method is used to draw graphics in the drawing area of the applet.
  • 24. repaint() • The repaint() method is used whenever you want to redraw the applet’s drawing area. • The repaint() method calls the update() method. • The update() method clears the applet area and calls the paint() method.
  • 25. paint() Syntax public void paint(Graphics g) { <display statements>; }
  • 26. Summary In this presentation, you learnt the following • Applets are Java programs mainly used in Internet computing. • The applet’s output is displayed within a subset of the display area of the browser. • Java applet inherits a set of default properties from the Applet class. • An applet enters the Initialisation state when it is first loaded.
  • 27. Summary In this presentation, you learnt the following • Applet enters the running state when the start() method of Applet class is invoked. • An applet becomes idle when it is stopped from running. • An applet is said to be dead when it is removed from memory.
  • 28. Assignment 1. Define an applet. List the uses of applets. 2. Sketch and explain the life cycle of an applet.