SlideShare a Scribd company logo
3
Most read
9
Most read
11
Most read
MRS.B.RAMA PRABHA,
ASSISTANT PROFESSOR,
DEPARTMENT OF COMPUTER SCIENCE,
K.C.S.KASI NADAR COLLEGE OF ARTS & SCIENCE, CHENNAI-21
APPLET PROGRAMMING IN JAVA
 INTRODUCTION.
 TYPES OF APPLET.
 HOW APPLET IS DIFFER FROM OTHER APPLICATIONS.
 STEPS TO DEVELOP AN APPLET.
 APPLET LIFE CYCLE.
 HOW TO RUN AN APPLET.
TOPICS COVERED
 An Applet is the special type of Java program that is run on
web browser.
 An applet class does not have main method and it extends
the java.applet.Applet class. An applet program runs
through applet viewer.
 An applet is a special kind of Java program that is designed
to be transmitted over the Internet and automatically
executed by a Java-compatible web browser.
INTRODUCTION
Applet
Local
applet
Remote
applet
TYPES OF APPLET
 Applets don’t use the main() method, but when they are loaded,
automatically call certain methods (init, start, paint, stop, destroy).
 They are embedded inside a web page and executed in browsers.
 Takes input through Graphical User Input ( GUI ).
 They cannot read from or write to the files on local computer.
 They cannot run any programs from the local computer.
 They are restricted from using libraries from other languages.
HOW APPLET DIFFER FROM
OTHER APPLICATIONS
1. Building an applet code(.java file)
2. Creating an executable file.(*.class file)
3. Designing a web page using HTML tags.
4. Preparing <APPLET> tag.
5. Creating HTML file.
6. Testing the applet code.
STEPS TO DEVELOP AN APPLET
APPLET LIFE CYCLE
 When an applet is loaded it
undergoes a series of
changes in its states.
 The applet states include
Born or Initialization
state
Running state
Idle state
Dead or destroyed state
APPLET LIFECYCLE
INITIALIZATION

The init( ) method is the first method to be called.
 This is where you should initialize variables.
 This method is called only once during the run time of
your applet.
RUNNING
The start( ) method is called after init( ).
 It is also called to restart an applet after it has been
stopped.
 It is called each time an applet’s HTML document is
displayed on screen.
 So, if a user leaves a web page and comes back, the applet
resumes execution at start( ).
Display
 paint() happens immediately after the applet enters into
the running state.It is responsible for displaying output.
 paint( ) is also called when the applet begins execution.
 The paint( ) method is called each time your applet’s
output must be redrawn.
 The paint( ) method has one parameter of type Graphics.
Idle
The stop( ) method is called when a web browser leaves
the HTML document containing the applet—when it goes
to another page.
Dead/Destroyed State
Applet is said to be dead when it is removed from
memory. This occurs by calling destroy() method.
There are two ways to run an applet
 By html file.
 By applet Viewer tool .
HOW TO RUN AN APPLET?
Simple example of Applet by html file:
To execute the applet by html file, create an applet and compile it. After
that create an html file and place the applet code in html file. Now click
the html file.
//First.java
import java.applet.Applet;
import java.awt.Graphics;
public class First extends Applet
{
public void paint(Graphics g)
{
g.drawString(“Hello World",150,150);
}
}
<html>
<body>
<applet code="First.class"
width="300" height="300">
</applet>
</body>
</html>
To execute the applet by applet viewer tool, create an applet that contains
applet tag in comment and compile it. After that run it by: applet viewer
First.java. Now Html file is not required but it is for testing purpose only.
//First.java
import java.applet.Applet;
import java.awt.Graphics;
public class First extends Applet
{
public void paint(Graphics g){
g.drawString(“Hello world",150,150);
}
}
/*
<applet code="First.class" width="300
" height="300">
</applet>
*/
 To execute the applet by
applet viewer tool, write
in command prompt:
 c:>javac First.java
c:>appletviewer
First.java
OUTPUT
Applets in Java

More Related Content

PPT
Java applets
PDF
JAVA APPLETS
PPTX
Java applets
PDF
27 applet programming
PDF
ITFT- Applet in java
PPT
Java applets
PPTX
Java applet - java
Java applets
JAVA APPLETS
Java applets
27 applet programming
ITFT- Applet in java
Java applets
Java applet - java

What's hot (20)

PDF
Applet in java
PPT
Applet and graphics programming
PPTX
Applet progming
PPT
JAVA APPLET BASICS
PPTX
6.applet programming in java
PPTX
Java Applets
PPTX
Java applet
PPTX
L18 applets
PPT
Appl clas nd architect.56
PPTX
PPTX
java Applet Introduction
PPTX
Applet programming in java
PPTX
Applet programming
PPT
first-applet
PPT
Java Applet
PPT
Applet Architecture - Introducing Java Applets
PPT
Java applet
PPT
Applet skelton58
PPT
Applets
Applet in java
Applet and graphics programming
Applet progming
JAVA APPLET BASICS
6.applet programming in java
Java Applets
Java applet
L18 applets
Appl clas nd architect.56
java Applet Introduction
Applet programming in java
Applet programming
first-applet
Java Applet
Applet Architecture - Introducing Java Applets
Java applet
Applet skelton58
Applets
Ad

Similar to Applets in Java (20)

PPTX
Appletjava
PPTX
Java applet
PPTX
Applet1 (1).pptx
PPTX
Applets in Java. Learn java program with applets
PDF
Java applet basics
PDF
Class notes(week 10) on applet programming
PPTX
Applet (1)
PPTX
applet.pptx
PPTX
MSBTE Computer Engineering Java applet.pptx
PPT
Java programming Java programming Java programming
PPT
Java files and io streams
DOCX
Lecture1 oopj
PPTX
Applet
PPT
Basic of Applet
PPT
Advanced Programming, Java Programming, Applets.ppt
DOCX
Class notes(week 10) on applet programming
PDF
Advanced programming chapter 2 - Java Applet.pdf
PPT
Java: Java Applets
Appletjava
Java applet
Applet1 (1).pptx
Applets in Java. Learn java program with applets
Java applet basics
Class notes(week 10) on applet programming
Applet (1)
applet.pptx
MSBTE Computer Engineering Java applet.pptx
Java programming Java programming Java programming
Java files and io streams
Lecture1 oopj
Applet
Basic of Applet
Advanced Programming, Java Programming, Applets.ppt
Class notes(week 10) on applet programming
Advanced programming chapter 2 - Java Applet.pdf
Java: Java Applets
Ad

More from RamaPrabha24 (12)

PPTX
Dynamic debugging in 8085 microprocessor
PPTX
programming techniques
PPTX
instruction format and addressing modes
PPTX
instruction set and classificaion
PPTX
LOGICAL OPERATIONS IN 8085 MICROPROCESSOR
PPTX
ARITHMETIC OPERATIONS IN 8085 MICROPROCESSOR
PPTX
8085 DATA TRANSFER INSTRUCTIONS
PPTX
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
PPTX
PINDIAGRAM OF 8085 MICROPROCESSOR
PPT
memory classification
PPTX
Introduction to microprocessor
PPTX
Basic terms used in microprocessor
Dynamic debugging in 8085 microprocessor
programming techniques
instruction format and addressing modes
instruction set and classificaion
LOGICAL OPERATIONS IN 8085 MICROPROCESSOR
ARITHMETIC OPERATIONS IN 8085 MICROPROCESSOR
8085 DATA TRANSFER INSTRUCTIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
PINDIAGRAM OF 8085 MICROPROCESSOR
memory classification
Introduction to microprocessor
Basic terms used in microprocessor

Recently uploaded (20)

PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
01-Introduction-to-Information-Management.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Pharma ospi slides which help in ospi learning
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Microbial diseases, their pathogenesis and prophylaxis
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Supply Chain Operations Speaking Notes -ICLT Program
GDM (1) (1).pptx small presentation for students
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
TR - Agricultural Crops Production NC III.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Abdominal Access Techniques with Prof. Dr. R K Mishra
01-Introduction-to-Information-Management.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Cell Types and Its function , kingdom of life
Renaissance Architecture: A Journey from Faith to Humanism
Sports Quiz easy sports quiz sports quiz
human mycosis Human fungal infections are called human mycosis..pptx
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Pharma ospi slides which help in ospi learning
O5-L3 Freight Transport Ops (International) V1.pdf

Applets in Java

  • 1. MRS.B.RAMA PRABHA, ASSISTANT PROFESSOR, DEPARTMENT OF COMPUTER SCIENCE, K.C.S.KASI NADAR COLLEGE OF ARTS & SCIENCE, CHENNAI-21 APPLET PROGRAMMING IN JAVA
  • 2.  INTRODUCTION.  TYPES OF APPLET.  HOW APPLET IS DIFFER FROM OTHER APPLICATIONS.  STEPS TO DEVELOP AN APPLET.  APPLET LIFE CYCLE.  HOW TO RUN AN APPLET. TOPICS COVERED
  • 3.  An Applet is the special type of Java program that is run on web browser.  An applet class does not have main method and it extends the java.applet.Applet class. An applet program runs through applet viewer.  An applet is a special kind of Java program that is designed to be transmitted over the Internet and automatically executed by a Java-compatible web browser. INTRODUCTION
  • 5.  Applets don’t use the main() method, but when they are loaded, automatically call certain methods (init, start, paint, stop, destroy).  They are embedded inside a web page and executed in browsers.  Takes input through Graphical User Input ( GUI ).  They cannot read from or write to the files on local computer.  They cannot run any programs from the local computer.  They are restricted from using libraries from other languages. HOW APPLET DIFFER FROM OTHER APPLICATIONS
  • 6. 1. Building an applet code(.java file) 2. Creating an executable file.(*.class file) 3. Designing a web page using HTML tags. 4. Preparing <APPLET> tag. 5. Creating HTML file. 6. Testing the applet code. STEPS TO DEVELOP AN APPLET
  • 7. APPLET LIFE CYCLE  When an applet is loaded it undergoes a series of changes in its states.  The applet states include Born or Initialization state Running state Idle state Dead or destroyed state
  • 8. APPLET LIFECYCLE INITIALIZATION  The init( ) method is the first method to be called.  This is where you should initialize variables.  This method is called only once during the run time of your applet. RUNNING The start( ) method is called after init( ).  It is also called to restart an applet after it has been stopped.  It is called each time an applet’s HTML document is displayed on screen.  So, if a user leaves a web page and comes back, the applet resumes execution at start( ).
  • 9. Display  paint() happens immediately after the applet enters into the running state.It is responsible for displaying output.  paint( ) is also called when the applet begins execution.  The paint( ) method is called each time your applet’s output must be redrawn.  The paint( ) method has one parameter of type Graphics. Idle The stop( ) method is called when a web browser leaves the HTML document containing the applet—when it goes to another page. Dead/Destroyed State Applet is said to be dead when it is removed from memory. This occurs by calling destroy() method.
  • 10. There are two ways to run an applet  By html file.  By applet Viewer tool . HOW TO RUN AN APPLET?
  • 11. Simple example of Applet by html file: To execute the applet by html file, create an applet and compile it. After that create an html file and place the applet code in html file. Now click the html file. //First.java import java.applet.Applet; import java.awt.Graphics; public class First extends Applet { public void paint(Graphics g) { g.drawString(“Hello World",150,150); } } <html> <body> <applet code="First.class" width="300" height="300"> </applet> </body> </html>
  • 12. To execute the applet by applet viewer tool, create an applet that contains applet tag in comment and compile it. After that run it by: applet viewer First.java. Now Html file is not required but it is for testing purpose only. //First.java import java.applet.Applet; import java.awt.Graphics; public class First extends Applet { public void paint(Graphics g){ g.drawString(“Hello world",150,150); } } /* <applet code="First.class" width="300 " height="300"> </applet> */  To execute the applet by applet viewer tool, write in command prompt:  c:>javac First.java c:>appletviewer First.java