SlideShare a Scribd company logo
5
Most read
7
Most read
10
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

What's hot (20)

PPTX
Multithreading in java
Monika Mishra
 
PPT
Mvc architecture
Surbhi Panhalkar
 
PDF
Introduction to java (revised)
Sujit Majety
 
PPT
Basic of Multithreading in JAva
suraj pandey
 
PPT
Java servlet life cycle - methods ppt
kamal kotecha
 
PPTX
Advance Java Topics (J2EE)
slire
 
PPTX
VB.NET:An introduction to Namespaces in .NET framework
Richa Handa
 
PPT
Java collections concept
kumar gaurav
 
PPT
JAVA APPLET BASICS
Shanid Malayil
 
PPT
Asp.net.
Naveen Sihag
 
PPT
Array in Java
Shehrevar Davierwala
 
PPTX
JavaFX Presentation
Mochamad Taufik Mulyadi
 
PPTX
Chapter 3 servlet & jsp
Jafar Nesargi
 
PPTX
Joomla and cms
waseem ahmad
 
PPTX
Event handling
Anand Grewal
 
PDF
Generic Programming
Muhammad Alhalaby
 
PPT
JDBC Architecture and Drivers
SimoniShah6
 
DOCX
Autoboxing and unboxing
Geetha Manohar
 
Multithreading in java
Monika Mishra
 
Mvc architecture
Surbhi Panhalkar
 
Introduction to java (revised)
Sujit Majety
 
Basic of Multithreading in JAva
suraj pandey
 
Java servlet life cycle - methods ppt
kamal kotecha
 
Advance Java Topics (J2EE)
slire
 
VB.NET:An introduction to Namespaces in .NET framework
Richa Handa
 
Java collections concept
kumar gaurav
 
JAVA APPLET BASICS
Shanid Malayil
 
Asp.net.
Naveen Sihag
 
Array in Java
Shehrevar Davierwala
 
JavaFX Presentation
Mochamad Taufik Mulyadi
 
Chapter 3 servlet & jsp
Jafar Nesargi
 
Joomla and cms
waseem ahmad
 
Event handling
Anand Grewal
 
Generic Programming
Muhammad Alhalaby
 
JDBC Architecture and Drivers
SimoniShah6
 
Autoboxing and unboxing
Geetha Manohar
 

Similar to Java applets (20)

PPTX
Applets in Java
RamaPrabha24
 
PPTX
Java applets
Pihu Goel
 
PDF
Java applet basics
Sunil Pandey
 
PPTX
MSBTE Computer Engineering Java applet.pptx
kunalgaikwad1705
 
DOCX
Java applet-basics
kanchanmahajan23
 
PDF
Java applet-basics
kanchanmahajan23
 
PPT
Java files and io streams
RubaNagarajan
 
PPTX
applet.pptx
SachinBhosale73
 
PPTX
PROGRAMMING IN JAVA- unit 4-part I
SivaSankari36
 
PPTX
Appletjava
DEEPIKA T
 
DOCX
Class notes(week 10) on applet programming
Kuntal Bhowmick
 
PDF
Java basics notes
sanchi Sharma
 
PDF
Java programming basics notes for beginners(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PDF
Java basics notes
Nexus
 
PDF
Java basics notes
Gomathi Gomu
 
PPT
Applet Architecture - Introducing Java Applets
amitksaha
 
PPT
Basic of Applet
suraj pandey
 
PDF
Class notes(week 10) on applet programming
Kuntal Bhowmick
 
PPT
Javalecture 1
mrinalbhutani
 
Applets in Java
RamaPrabha24
 
Java applets
Pihu Goel
 
Java applet basics
Sunil Pandey
 
MSBTE Computer Engineering Java applet.pptx
kunalgaikwad1705
 
Java applet-basics
kanchanmahajan23
 
Java applet-basics
kanchanmahajan23
 
Java files and io streams
RubaNagarajan
 
applet.pptx
SachinBhosale73
 
PROGRAMMING IN JAVA- unit 4-part I
SivaSankari36
 
Appletjava
DEEPIKA T
 
Class notes(week 10) on applet programming
Kuntal Bhowmick
 
Java basics notes
sanchi Sharma
 
Java programming basics notes for beginners(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Java basics notes
Nexus
 
Java basics notes
Gomathi Gomu
 
Applet Architecture - Introducing Java Applets
amitksaha
 
Basic of Applet
suraj pandey
 
Class notes(week 10) on applet programming
Kuntal Bhowmick
 
Javalecture 1
mrinalbhutani
 
Ad

More from M Vishnuvardhan Reddy (20)

PPTX
Python Sets_Dictionary.pptx
M Vishnuvardhan Reddy
 
PPTX
Lists_tuples.pptx
M Vishnuvardhan Reddy
 
PPTX
Python Control Structures.pptx
M Vishnuvardhan Reddy
 
PPTX
Python Strings.pptx
M Vishnuvardhan Reddy
 
PPTX
Python Basics.pptx
M Vishnuvardhan Reddy
 
PPTX
Python Operators.pptx
M Vishnuvardhan Reddy
 
PPTX
Python Datatypes.pptx
M Vishnuvardhan Reddy
 
PPTX
DataScience.pptx
M Vishnuvardhan Reddy
 
PPT
Html forms
M Vishnuvardhan Reddy
 
PPT
Cascading Style Sheets
M Vishnuvardhan Reddy
 
PPT
Java Threads
M Vishnuvardhan Reddy
 
PPT
Java Streams
M Vishnuvardhan Reddy
 
PPT
Scanner class
M Vishnuvardhan Reddy
 
PPT
Polymorphism
M Vishnuvardhan Reddy
 
PPT
Java intro
M Vishnuvardhan Reddy
 
PPT
Exception handling
M Vishnuvardhan Reddy
 
PPT
Control structures
M Vishnuvardhan Reddy
 
PPT
Constructors
M Vishnuvardhan Reddy
 
PPT
Classes&amp;objects
M Vishnuvardhan Reddy
 
PPS
Shell sort
M Vishnuvardhan Reddy
 
Python Sets_Dictionary.pptx
M Vishnuvardhan Reddy
 
Lists_tuples.pptx
M Vishnuvardhan Reddy
 
Python Control Structures.pptx
M Vishnuvardhan Reddy
 
Python Strings.pptx
M Vishnuvardhan Reddy
 
Python Basics.pptx
M Vishnuvardhan Reddy
 
Python Operators.pptx
M Vishnuvardhan Reddy
 
Python Datatypes.pptx
M Vishnuvardhan Reddy
 
DataScience.pptx
M Vishnuvardhan Reddy
 
Cascading Style Sheets
M Vishnuvardhan Reddy
 
Java Threads
M Vishnuvardhan Reddy
 
Java Streams
M Vishnuvardhan Reddy
 
Scanner class
M Vishnuvardhan Reddy
 
Polymorphism
M Vishnuvardhan Reddy
 
Exception handling
M Vishnuvardhan Reddy
 
Control structures
M Vishnuvardhan Reddy
 
Constructors
M Vishnuvardhan Reddy
 
Classes&amp;objects
M Vishnuvardhan Reddy
 
Ad

Recently uploaded (20)

PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
The Future of Artificial Intelligence (AI)
Mukul
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 

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