SlideShare a Scribd company logo
Applet Class
Applet Life cycle
Applet Skeleton
Applet Status Window
Applet Class
• An applet is a small Internet-based program written in Java, a
programming language for the Web, which can be downloaded by any
computer
• The applet is also able to run in HTML
What Applets are?
• Applets are dynamic (animations and graphics).
• Applets are interactive programs (via GUI components).
Features of an Applet
• Provides facility for frames
• Event handling facility and user Interaction
• GUI user interface
• Graphics and multimedia
java Applet Introduction
Sample program of Applet
import java.applet.*;
import java.awt.*;
import java.applet.Applet;
public class Applet_Class extends Applet {
public void paint(Graphics g)
{
g.drawString("hello world",20,20);
}
}
Applet Skeleton
Init()
• The init method is the first method to be called.
• Used for Initialize variables.
• Only once during the run time of applet
Start()
• It is called after the init()
• Start method called each time of an applet’s displayed on screen.
Paint()
• Paint method is called each time your applet’s output must be redarwn.
Stop()
• Stop method is called when a browser close.
• The running applet will get stop
• The applet is in suspend state
Destroy()
• This method remove the applet completely from memory
import java.applet.*; import java.awt.*; import java.applet.Applet;
public class Applet_Class extends Applet
{ private static int initcall, startcall, paintcall, stopcall, destroycall;
public void init()
{ setBackground(Color.cyan);
setForeground(Color.red);
initcall=initcall+1;
}
public void start()
{ startcall=startcall+1; }
public void stop()
{ stopcall=stopcall+1;
g.drawString("stop method", 0,1);
}
public void destroy()
{ destroycall=destroycall+1; }
public void paint(Graphics g)
{ paintcall=paintcall+1;
g.drawString("init Method is called for : "+initcall,0,14);
g.drawString("start Method is called for : "+startcall,0,30);
g.drawString("paint Method is called for : "+paintcall,0,46);
g.drawString("stop Method is called for : "+stopcall,0,62);
g.drawString("destroy Method is called for : "+destroycall,0,78);
showStatus("Demo of Applet Life Cycle");
}
}
Using the Status Window
import java.applet.*;
import java.awt.*;
import java.applet.Applet;
public class Applet_Class extends Applet
{ public void init()
{ }
public void paint(Graphics g)
{ g.drawString("hellow see status at bottom",
40,40);
showStatus("yugandhar");
}
}

More Related Content

PDF
27 applet programming
PPTX
Method overloading
PPT
Java awt
PPT
Core java slides
PPTX
Method Overloading in Java
PPT
Java: Java Applets
PPT
Java static keyword
PPT
Basic of Multithreading in JAva
27 applet programming
Method overloading
Java awt
Core java slides
Method Overloading in Java
Java: Java Applets
Java static keyword
Basic of Multithreading in JAva

What's hot (20)

PPTX
Java abstract class & abstract methods
PPT
Final keyword in java
PPTX
Spring jdbc
PPTX
Java swing
PPTX
Java - Generic programming
PPTX
Static keyword ppt
PDF
Java IO
PPSX
Collections - Maps
PPTX
Java interface
PPTX
History Of JAVA
PPTX
Multithreading in java
PDF
Java 8 features
PPTX
Multithreading in java
PPTX
Java Method, Static Block
PPTX
INHERITANCE IN JAVA.pptx
PPTX
Java.util
PDF
PPTX
Java 8 - Features Overview
PPTX
Java 8 features
PDF
Methods in Java
Java abstract class & abstract methods
Final keyword in java
Spring jdbc
Java swing
Java - Generic programming
Static keyword ppt
Java IO
Collections - Maps
Java interface
History Of JAVA
Multithreading in java
Java 8 features
Multithreading in java
Java Method, Static Block
INHERITANCE IN JAVA.pptx
Java.util
Java 8 - Features Overview
Java 8 features
Methods in Java
Ad

Viewers also liked (20)

PPT
Java applet
PPT
Applet Architecture - Introducing Java Applets
PPTX
Applet java
PPT
Applet life cycle
PPS
PPTX
Advanced VB: Object Oriented Programming - DLLs
PPTX
Open and Close Door ppt
PPTX
L13 string handling(string class)
PPS
String and string buffer
PPT
Java Applet
PPTX
applet using java
PDF
ITFT- Applet in java
PPTX
L18 applets
PPS
Interface
PDF
Java Applet and Graphics
PDF
String handling(string class)
PPTX
Java string handling
PPT
Java applets
PPT
String handling session 5
Java applet
Applet Architecture - Introducing Java Applets
Applet java
Applet life cycle
Advanced VB: Object Oriented Programming - DLLs
Open and Close Door ppt
L13 string handling(string class)
String and string buffer
Java Applet
applet using java
ITFT- Applet in java
L18 applets
Interface
Java Applet and Graphics
String handling(string class)
Java string handling
Java applets
String handling session 5
Ad

Similar to java Applet Introduction (20)

PPTX
Java Applet presentation............pptx
PPTX
Applet in java new
PPTX
Java applet - java
PPTX
6.applet programming in java
PPTX
Applets in Java. Learn java program with applets
PPT
Applets
PPT
PDF
PPTX
Applet progming
PPTX
PPTX
Java applet
PPT
Applets
PPT
Applet and graphics programming
PPT
Applets
PPT
Basic of Applet
PPT
Slide8appletv2 091028110313-phpapp01
PPTX
Java chapter 7
PPT
PPTX
PPTX
Applet-Presentation-object-oriented-programming.pptx
Java Applet presentation............pptx
Applet in java new
Java applet - java
6.applet programming in java
Applets in Java. Learn java program with applets
Applets
Applet progming
Java applet
Applets
Applet and graphics programming
Applets
Basic of Applet
Slide8appletv2 091028110313-phpapp01
Java chapter 7
Applet-Presentation-object-oriented-programming.pptx

More from yugandhar vadlamudi (15)

ODP
Toolbarexample
ODP
Singleton pattern
PPT
Object Relational model for SQLIite in android
DOCX
JButton in Java Swing example
PPTX
Collections framework in java
PPTX
Packaes & interfaces
PPTX
Exception handling in java
DOCX
JMenu Creation in Java Swing
DOCX
Adding a action listener to button
PPTX
Dynamic method dispatch
PPTX
Operators in java
PPTX
Inheritance
PPTX
Control flow statements in java
PPTX
Closer look at classes
PPTX
Class introduction in java
Toolbarexample
Singleton pattern
Object Relational model for SQLIite in android
JButton in Java Swing example
Collections framework in java
Packaes & interfaces
Exception handling in java
JMenu Creation in Java Swing
Adding a action listener to button
Dynamic method dispatch
Operators in java
Inheritance
Control flow statements in java
Closer look at classes
Class introduction in java

Recently uploaded (20)

PDF
Anesthesia in Laparoscopic Surgery in India
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Cell Types and Its function , kingdom of life
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
GDM (1) (1).pptx small presentation for students
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
master seminar digital applications in india
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Basic Mud Logging Guide for educational purpose
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
Anesthesia in Laparoscopic Surgery in India
102 student loan defaulters named and shamed – Is someone you know on the list?
Cell Types and Its function , kingdom of life
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
GDM (1) (1).pptx small presentation for students
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
RMMM.pdf make it easy to upload and study
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Computing-Curriculum for Schools in Ghana
2.FourierTransform-ShortQuestionswithAnswers.pdf
master seminar digital applications in india
Sports Quiz easy sports quiz sports quiz
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
Basic Mud Logging Guide for educational purpose
human mycosis Human fungal infections are called human mycosis..pptx

java Applet Introduction

  • 1. Applet Class Applet Life cycle Applet Skeleton Applet Status Window
  • 2. Applet Class • An applet is a small Internet-based program written in Java, a programming language for the Web, which can be downloaded by any computer • The applet is also able to run in HTML What Applets are? • Applets are dynamic (animations and graphics). • Applets are interactive programs (via GUI components). Features of an Applet • Provides facility for frames • Event handling facility and user Interaction • GUI user interface • Graphics and multimedia
  • 4. Sample program of Applet import java.applet.*; import java.awt.*; import java.applet.Applet; public class Applet_Class extends Applet { public void paint(Graphics g) { g.drawString("hello world",20,20); } }
  • 5. Applet Skeleton Init() • The init method is the first method to be called. • Used for Initialize variables. • Only once during the run time of applet Start() • It is called after the init() • Start method called each time of an applet’s displayed on screen. Paint() • Paint method is called each time your applet’s output must be redarwn. Stop() • Stop method is called when a browser close. • The running applet will get stop • The applet is in suspend state Destroy() • This method remove the applet completely from memory
  • 6. import java.applet.*; import java.awt.*; import java.applet.Applet; public class Applet_Class extends Applet { private static int initcall, startcall, paintcall, stopcall, destroycall; public void init() { setBackground(Color.cyan); setForeground(Color.red); initcall=initcall+1; } public void start() { startcall=startcall+1; } public void stop() { stopcall=stopcall+1; g.drawString("stop method", 0,1); } public void destroy() { destroycall=destroycall+1; } public void paint(Graphics g) { paintcall=paintcall+1; g.drawString("init Method is called for : "+initcall,0,14); g.drawString("start Method is called for : "+startcall,0,30); g.drawString("paint Method is called for : "+paintcall,0,46); g.drawString("stop Method is called for : "+stopcall,0,62); g.drawString("destroy Method is called for : "+destroycall,0,78); showStatus("Demo of Applet Life Cycle"); } }
  • 7. Using the Status Window import java.applet.*; import java.awt.*; import java.applet.Applet; public class Applet_Class extends Applet { public void init() { } public void paint(Graphics g) { g.drawString("hellow see status at bottom", 40,40); showStatus("yugandhar"); } }