SlideShare a Scribd company logo
2
Most read
5
Most read
7
Most read
SSBN Degree College, ATP M Vishnuvardhan
Java Applets
-M Vishnuvardhan,
Dept. of Computer Science,
SSBN Degree College, ATP
SSBN Degree College, ATP M Vishnuvardhan
» Java programs are divided into two main
categories, applets and applications
» An application is an ordinary Java program
» An applet is a kind of Java program that can
be run across the Internet
Applets: Introduction
SSBN Degree College, ATP M Vishnuvardhan
» Applets are mainly used convert a static web
page to dynamic page
» Web is created with the help of Hypertext
markup language (HTML).
» Web site is collection of webpages of a
particular organization.
» A browser is a software which is used to browse
the internet ie., used to view web pages
Applets: Introduction
SSBN Degree College, ATP M Vishnuvardhan
» Applets do not use main() method
» Applets needs html code to run
» Applets are run by Java enabled
web browser.
» Applets are by default GUI Apps.
Applets vs. Applications
SSBN Degree College, ATP M Vishnuvardhan
» To deal with applets in java a special class is
defined in java.applet package called as
Applet.
» Applet class contains five special methods
init() :- used for initialization of applet
start() :- used to start an applet
paint() :- used to paint the contents of the
applet on the window
stop() :- used to stop an applet
destroy() :- used to destroy an applet
»Applet methods are automatically called one
after another once they are loaded into web
browser
Applet Class
SSBN Degree College, ATP M Vishnuvardhan
In order to create an applet the following steps
are to be followed
»Create a class by extending applet class
»Override any one of the applet class method
»Compile the program to obtain the class file
»Create a html document and embed the applet
»Run the applet along with the html page in
java enabled web browser
Creation of Applets
SSBN Degree College, ATP M Vishnuvardhan
// Sample Applet program
import java.awt.*;
import java.applet.*;
public class DemoApp extends Applet
{
public void paint(Graphics g)
{
g.drawString(“Java applets”, 50,50);
}
}
Note:- After compiling the program embed the applet in a
html file and open in java enabled web browser.
Creation of Applets
SSBN Degree College, ATP M Vishnuvardhan
Html is a language used to design a web page
Basic structure of html file is
<html>
<! ------Comment Section ---- >
<head> <title> title of the page </title>
</head>
<body>
Body of the web page
</body>
</html>
HTML
SSBN Degree College, ATP M Vishnuvardhan
Commonly used html tags
<b> … </b>
<i> … </i>
<u> … </u>
<h1> .. </h1> to <h7> … </h7>
<applet> …. </applet>
HTML
SSBN Degree College, ATP M Vishnuvardhan
An Applet is embedded in a html file using
<applet> tag. Applet tag contains three main
attributes
Code :- specifies the class name of applet
Height :- specifies the height of the applet
Width :- specifies the width of the applet
Alignment :- specifies the alignment of applet
Hspace :- specifies the horizontal and
Vspace :- vertical space around the applet
EG:-
<applet code=“Demo” width=“300” height=“300”>
</applet>
Embedding an applet in html file
SSBN Degree College, ATP M Vishnuvardhan
Applet life cycle contains four necessary states
1. Born or Initialization state
2. Running State
3. Idle state
4. Dead state
In this four states applet class five methods are
executed on after another.
Applet Life Cycle
SSBN Degree College, ATP M Vishnuvardhan
Applet Life Cycle
Born
Running Idle
Dead
start()
stop()
destroy()
start()
paint()
Loading of
applet
Exit of
browser
SSBN Degree College, ATP M Vishnuvardhan
It is possible to pass data from a html page to
applet program. This can be done with the
help of <PARAM> tag in html
<APPLET .. . .. . .>
<PARAM name=“ ..” value=”…”/>
</APPLET>
Here the name corresponds the name of the
parameter and value associates the value of
the parameter
Passing parameters to Applet
SSBN Degree College, ATP M Vishnuvardhan
The parameters from the <PARAM> tag can be
read in the applet program with the help of
following method
String getParameter(String name):
returns the value associated with the
specified parameter.
Passing parameters to Applet
SSBN Degree College, ATP M Vishnuvardhan
Questions

More Related Content

PPTX
Object Oriented Programming
PPTX
Inner classes in java
PDF
Arrays in Java
PPT
Java inheritance
PPTX
Java swing
PPT
MYSQL - PHP Database Connectivity
PPS
Wrapper class
Object Oriented Programming
Inner classes in java
Arrays in Java
Java inheritance
Java swing
MYSQL - PHP Database Connectivity
Wrapper class

What's hot (20)

PPTX
Features of java
PPTX
Inheritance in JAVA PPT
PDF
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
PPTX
Python Functions
PDF
Collections in Java Notes
PDF
Java Linked List Tutorial | Edureka
ODP
Garbage collection
PPTX
Constructor ppt
PPTX
Java Strings
PDF
Java Garbage Collection - How it works
PDF
4 pillars of OOPS CONCEPT
PPT
JDBC – Java Database Connectivity
PPTX
Java - Collections framework
PPTX
Abstract class and Interface
PPSX
Exception Handling
PPT
Basic concept of OOP's
PPTX
Classes, objects in JAVA
PPTX
Java abstract class & abstract methods
PPTX
I/O Streams
PPTX
Windows form application - C# Training
Features of java
Inheritance in JAVA PPT
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Python Functions
Collections in Java Notes
Java Linked List Tutorial | Edureka
Garbage collection
Constructor ppt
Java Strings
Java Garbage Collection - How it works
4 pillars of OOPS CONCEPT
JDBC – Java Database Connectivity
Java - Collections framework
Abstract class and Interface
Exception Handling
Basic concept of OOP's
Classes, objects in JAVA
Java abstract class & abstract methods
I/O Streams
Windows form application - C# Training
Ad

Similar to Java applets (20)

PPT
JAVA APPLET BASICS
PPT
Jsp applet
PPTX
MSBTE Computer Engineering Java applet.pptx
PPTX
applet.pptx
PPTX
Introduction To Applets methods and simple examples
PPTX
Applet Programming in Advance Java Programming
PDF
UNIT-1-AJAVA.pdf
PDF
Class notes(week 10) on applet programming
PDF
Java applets and working principles
PPTX
Java applets
PDF
Java applet programming concepts
DOCX
Class notes(week 10) on applet programming
PPTX
Java applet
PPTX
Applet in java new
PPTX
Java Applets
PDF
Advanced programming chapter 2 - Java Applet.pdf
PPTX
The Applet Concept in Java Programming.pptx
PPT
Advanced Programming, Java Programming, Applets.ppt
PPTX
Applet
PPTX
Applets in Java. Learn java program with applets
JAVA APPLET BASICS
Jsp applet
MSBTE Computer Engineering Java applet.pptx
applet.pptx
Introduction To Applets methods and simple examples
Applet Programming in Advance Java Programming
UNIT-1-AJAVA.pdf
Class notes(week 10) on applet programming
Java applets and working principles
Java applets
Java applet programming concepts
Class notes(week 10) on applet programming
Java applet
Applet in java new
Java Applets
Advanced programming chapter 2 - Java Applet.pdf
The Applet Concept in Java Programming.pptx
Advanced Programming, Java Programming, Applets.ppt
Applet
Applets in Java. Learn java program with applets
Ad

More from M Vishnuvardhan Reddy (20)

PPTX
Python Sets_Dictionary.pptx
PPTX
Lists_tuples.pptx
PPTX
Python Control Structures.pptx
PPTX
Python Strings.pptx
PPTX
Python Basics.pptx
PPTX
Python Operators.pptx
PPTX
Python Datatypes.pptx
PPTX
DataScience.pptx
PPT
PPT
Cascading Style Sheets
PPT
Java Threads
PPT
Java Streams
PPT
Scanner class
PPT
Polymorphism
PPT
PPT
Exception handling
PPT
Control structures
PPT
Constructors
PPT
Classes&amp;objects
PPS
Python Sets_Dictionary.pptx
Lists_tuples.pptx
Python Control Structures.pptx
Python Strings.pptx
Python Basics.pptx
Python Operators.pptx
Python Datatypes.pptx
DataScience.pptx
Cascading Style Sheets
Java Threads
Java Streams
Scanner class
Polymorphism
Exception handling
Control structures
Constructors
Classes&amp;objects

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Electronic commerce courselecture one. Pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Empathic Computing: Creating Shared Understanding
PDF
Machine learning based COVID-19 study performance prediction
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Encapsulation_ Review paper, used for researhc scholars
NewMind AI Weekly Chronicles - August'25 Week I
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
MIND Revenue Release Quarter 2 2025 Press Release
20250228 LYD VKU AI Blended-Learning.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Electronic commerce courselecture one. Pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
sap open course for s4hana steps from ECC to s4
Empathic Computing: Creating Shared Understanding
Machine learning based COVID-19 study performance prediction
Unlocking AI with Model Context Protocol (MCP)
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Review of recent advances in non-invasive hemoglobin estimation

Java applets

  • 1. SSBN Degree College, ATP M Vishnuvardhan Java Applets -M Vishnuvardhan, Dept. of Computer Science, SSBN Degree College, ATP
  • 2. SSBN Degree College, ATP M Vishnuvardhan » Java programs are divided into two main categories, applets and applications » An application is an ordinary Java program » An applet is a kind of Java program that can be run across the Internet Applets: Introduction
  • 3. SSBN Degree College, ATP M Vishnuvardhan » Applets are mainly used convert a static web page to dynamic page » Web is created with the help of Hypertext markup language (HTML). » Web site is collection of webpages of a particular organization. » A browser is a software which is used to browse the internet ie., used to view web pages Applets: Introduction
  • 4. SSBN Degree College, ATP M Vishnuvardhan » Applets do not use main() method » Applets needs html code to run » Applets are run by Java enabled web browser. » Applets are by default GUI Apps. Applets vs. Applications
  • 5. SSBN Degree College, ATP M Vishnuvardhan » To deal with applets in java a special class is defined in java.applet package called as Applet. » Applet class contains five special methods init() :- used for initialization of applet start() :- used to start an applet paint() :- used to paint the contents of the applet on the window stop() :- used to stop an applet destroy() :- used to destroy an applet »Applet methods are automatically called one after another once they are loaded into web browser Applet Class
  • 6. SSBN Degree College, ATP M Vishnuvardhan In order to create an applet the following steps are to be followed »Create a class by extending applet class »Override any one of the applet class method »Compile the program to obtain the class file »Create a html document and embed the applet »Run the applet along with the html page in java enabled web browser Creation of Applets
  • 7. SSBN Degree College, ATP M Vishnuvardhan // Sample Applet program import java.awt.*; import java.applet.*; public class DemoApp extends Applet { public void paint(Graphics g) { g.drawString(“Java applets”, 50,50); } } Note:- After compiling the program embed the applet in a html file and open in java enabled web browser. Creation of Applets
  • 8. SSBN Degree College, ATP M Vishnuvardhan Html is a language used to design a web page Basic structure of html file is <html> <! ------Comment Section ---- > <head> <title> title of the page </title> </head> <body> Body of the web page </body> </html> HTML
  • 9. SSBN Degree College, ATP M Vishnuvardhan Commonly used html tags <b> … </b> <i> … </i> <u> … </u> <h1> .. </h1> to <h7> … </h7> <applet> …. </applet> HTML
  • 10. SSBN Degree College, ATP M Vishnuvardhan An Applet is embedded in a html file using <applet> tag. Applet tag contains three main attributes Code :- specifies the class name of applet Height :- specifies the height of the applet Width :- specifies the width of the applet Alignment :- specifies the alignment of applet Hspace :- specifies the horizontal and Vspace :- vertical space around the applet EG:- <applet code=“Demo” width=“300” height=“300”> </applet> Embedding an applet in html file
  • 11. SSBN Degree College, ATP M Vishnuvardhan Applet life cycle contains four necessary states 1. Born or Initialization state 2. Running State 3. Idle state 4. Dead state In this four states applet class five methods are executed on after another. Applet Life Cycle
  • 12. SSBN Degree College, ATP M Vishnuvardhan Applet Life Cycle Born Running Idle Dead start() stop() destroy() start() paint() Loading of applet Exit of browser
  • 13. SSBN Degree College, ATP M Vishnuvardhan It is possible to pass data from a html page to applet program. This can be done with the help of <PARAM> tag in html <APPLET .. . .. . .> <PARAM name=“ ..” value=”…”/> </APPLET> Here the name corresponds the name of the parameter and value associates the value of the parameter Passing parameters to Applet
  • 14. SSBN Degree College, ATP M Vishnuvardhan The parameters from the <PARAM> tag can be read in the applet program with the help of following method String getParameter(String name): returns the value associated with the specified parameter. Passing parameters to Applet
  • 15. SSBN Degree College, ATP M Vishnuvardhan Questions