SlideShare a Scribd company logo
Applets in Java
Not Apples
Presented By: Wani Zahoor
Introduction
 Applet is small java program that can be easily
transported over the network from one
computer to other.
 used in internet applications.
 embedded in an html page, can be downloaded
from the server and run on the client, so as to
do a specific kind of job.
Types of Java Programmes
 Standalone
 Web based
Stand Alone Program
Web-Based Program
Difference between an
applet and application
APPLET CLASS
 java.applet.Applet is the
super class of the all the
applets.
 Applet class has a
predefined hierarchy
Applet Example
import java.applet.*;
import java.awt.*;
public class FirstApplet extends Applet {
public void paint(Graphics g) {
g.drawString(“Welcome in Applets”,10,50);
}
}
The Output
Applet Life cycle
 An applet may move from one state to another
depending upon a set of default behaviours inherited in
the form of methods from ‘Applet’ class.
 These states are
 Born
 Running
 Idle
 Dead
Applet State Diagram
Life cycle of Applet
 init() –
 creates the objects needed by the applet;
 sets up initial values, load font and images or set up colors.
 called only once during the lifetime of on Applet.
 start()-
 moves to this phase automatically after the initialization state.
 if the applet is stopped or it goes to idle state, start() method must be called in
order to force the applet again to the running state.
 paint() -
 This method is called each time to draw and redraw the output of an applet.
 stop()-
 idle state, once it is stopped from running
 destroy()-
 An applet goes to dead state when it is destroyed by invoking the destroy() method
of Applet class.
 It results in complete removal of applet from the memory.
Common Methods drawString()-
 member of Graphics class, used to output a string to an applet.
 It is typically called from within the paint() or update() method.
 void drawString(String msg,int a, int b)
 setBackground() & getBackground()
 belongs to Component class, used to set and get the background color.
 void setBackground(Color anyColor)
 predefined constants for each color, such as Color.red can be used.
 setForeground() & get Foreground()
 set and gets the color of the text to be displayed on the foreground of the
applet window.
 void setForeground(Color anyColor)
 showStatus()
 display any string in the status window of the browser
 void showString(String text)
Graphics class
import java.awt.* ;
import java.applet.* ;
public class DrawLineRect extends Applet {
public void paint(Graphics g){
g.drawRect(10,60,40,30);
g.fillRect(60,10,30,80);
g.fillOval(140,160,170,170);
g.drawRoundRect(10,100,80,50,10,10);
g.fillRoundRect(20,110,60,30,5,5);
g.drawArc(280,210,250,220,30,90);
g.drawLine(100,10,230,140);
g.drawLine(100,140,230,10);
}}
The Output
Now your turn..!!!
 How to programme this…..????
HTML Tag
<applet code="Bubbles.class" width="350" height="350">
</applet>
Applets in java
Ad

More Related Content

What's hot (20)

Event Handling in java
Event Handling in javaEvent Handling in java
Event Handling in java
Google
 
Java awt (abstract window toolkit)
Java awt (abstract window toolkit)Java awt (abstract window toolkit)
Java awt (abstract window toolkit)
Elizabeth alexander
 
Event handling
Event handlingEvent handling
Event handling
swapnac12
 
Java And Multithreading
Java And MultithreadingJava And Multithreading
Java And Multithreading
Shraddha
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
Farooq Baloch
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
shanmuga rajan
 
Method overloading
Method overloadingMethod overloading
Method overloading
Lovely Professional University
 
Java thread life cycle
Java thread life cycleJava thread life cycle
Java thread life cycle
Archana Gopinath
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
Naz Abdalla
 
Control structures in java
Control structures in javaControl structures in java
Control structures in java
VINOTH R
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Operators in java
Operators in javaOperators in java
Operators in java
Then Murugeshwari
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
 
Java package
Java packageJava package
Java package
CS_GDRCST
 
Java Thread Synchronization
Java Thread SynchronizationJava Thread Synchronization
Java Thread Synchronization
Benj Del Mundo
 
Java constructors
Java constructorsJava constructors
Java constructors
QUONTRASOLUTIONS
 
Generics
GenericsGenerics
Generics
Ravi_Kant_Sahu
 
Inter Thread Communicationn.pptx
Inter Thread Communicationn.pptxInter Thread Communicationn.pptx
Inter Thread Communicationn.pptx
SelvakumarNSNS
 
File handling
File handlingFile handling
File handling
priya_trehan
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 

Viewers also liked (20)

Applet life cycle
Applet life cycleApplet life cycle
Applet life cycle
myrajendra
 
Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and Graphics
Abdul Rahman Sherzad
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
amitksaha
 
java Unit4 chapter1 applets
java Unit4 chapter1 appletsjava Unit4 chapter1 applets
java Unit4 chapter1 applets
raksharao
 
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet
backdoor
 
Satish training ppt
Satish training pptSatish training ppt
Satish training ppt
satish lariya
 
Basics of applets.53
Basics of applets.53Basics of applets.53
Basics of applets.53
myrajendra
 
Srgoc java
Srgoc javaSrgoc java
Srgoc java
Gaurav Singh
 
L5 classes, objects, nested and inner class
L5 classes, objects, nested and inner classL5 classes, objects, nested and inner class
L5 classes, objects, nested and inner class
teach4uin
 
Thread model of java
Thread model of javaThread model of java
Thread model of java
myrajendra
 
Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programming
mcanotes
 
Java Course 10: Threads and Concurrency
Java Course 10: Threads and ConcurrencyJava Course 10: Threads and Concurrency
Java Course 10: Threads and Concurrency
Anton Keks
 
L18 applets
L18 appletsL18 applets
L18 applets
teach4uin
 
Java Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet ProgramsJava Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet Programs
Trinity Dwarka
 
Jsp
JspJsp
Jsp
Khan Mac-arther
 
Java Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data StructuresJava Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data Structures
Hitendra Kumar
 
Static keyword ppt
Static keyword pptStatic keyword ppt
Static keyword ppt
Vinod Kumar
 
6.applet programming in java
6.applet programming in java6.applet programming in java
6.applet programming in java
Deepak Sharma
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
BHUVIJAYAVELU
 
Estructura de datos: lista, pilas y colas
Estructura de datos: lista, pilas y colasEstructura de datos: lista, pilas y colas
Estructura de datos: lista, pilas y colas
Huascar Génere
 
Applet life cycle
Applet life cycleApplet life cycle
Applet life cycle
myrajendra
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
amitksaha
 
java Unit4 chapter1 applets
java Unit4 chapter1 appletsjava Unit4 chapter1 applets
java Unit4 chapter1 applets
raksharao
 
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet
backdoor
 
Basics of applets.53
Basics of applets.53Basics of applets.53
Basics of applets.53
myrajendra
 
L5 classes, objects, nested and inner class
L5 classes, objects, nested and inner classL5 classes, objects, nested and inner class
L5 classes, objects, nested and inner class
teach4uin
 
Thread model of java
Thread model of javaThread model of java
Thread model of java
myrajendra
 
Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programming
mcanotes
 
Java Course 10: Threads and Concurrency
Java Course 10: Threads and ConcurrencyJava Course 10: Threads and Concurrency
Java Course 10: Threads and Concurrency
Anton Keks
 
Java Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet ProgramsJava Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet Programs
Trinity Dwarka
 
Java Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data StructuresJava Performance, Threading and Concurrent Data Structures
Java Performance, Threading and Concurrent Data Structures
Hitendra Kumar
 
Static keyword ppt
Static keyword pptStatic keyword ppt
Static keyword ppt
Vinod Kumar
 
6.applet programming in java
6.applet programming in java6.applet programming in java
6.applet programming in java
Deepak Sharma
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
BHUVIJAYAVELU
 
Estructura de datos: lista, pilas y colas
Estructura de datos: lista, pilas y colasEstructura de datos: lista, pilas y colas
Estructura de datos: lista, pilas y colas
Huascar Génere
 
Ad

Similar to Applets in java (20)

Applet in java new
Applet in java newApplet in java new
Applet in java new
Kavitha713564
 
Applet (1)
Applet (1)Applet (1)
Applet (1)
DEEPIKA T
 
Oops
OopsOops
Oops
RichaDasila
 
Appletsbjhbjiibibibikbibibjibjbibbjb.ppt
Appletsbjhbjiibibibikbibibjibjbibbjb.pptAppletsbjhbjiibibibikbibibjibjbibbjb.ppt
Appletsbjhbjiibibibikbibibjibjbibbjb.ppt
Vijay Bhaskar Thatty
 
Applets(1)cusdhsiohisdhfshihfsihfohf.ppt
Applets(1)cusdhsiohisdhfshihfsihfohf.pptApplets(1)cusdhsiohisdhfshihfsihfohf.ppt
Applets(1)cusdhsiohisdhfshihfsihfohf.ppt
Vijay Bhaskar Thatty
 
Unit 7 Java
Unit 7 JavaUnit 7 Java
Unit 7 Java
arnold 7490
 
Applet
AppletApplet
Applet
Priyanka Pradhan
 
27 applet programming
27  applet programming27  applet programming
27 applet programming
Ravindra Rathore
 
Basic of Applet
Basic of AppletBasic of Applet
Basic of Applet
suraj pandey
 
Applet progming
Applet progmingApplet progming
Applet progming
VIKRANTHMALLIKARJUN
 
Java Applet presentation............pptx
Java Applet presentation............pptxJava Applet presentation............pptx
Java Applet presentation............pptx
ZaildarHussainFaisal
 
Graphics programming in Java
Graphics programming in JavaGraphics programming in Java
Graphics programming in Java
Tushar B Kute
 
Java Applet
Java AppletJava Applet
Java Applet
jalinder123
 
java programming - applets
java programming - appletsjava programming - applets
java programming - applets
HarshithaAllu
 
Applets in Java. Learn java program with applets
Applets in Java. Learn java program with appletsApplets in Java. Learn java program with applets
Applets in Java. Learn java program with applets
halaplay385
 
Smart material - Unit 3 (2).pdf
Smart material - Unit 3 (2).pdfSmart material - Unit 3 (2).pdf
Smart material - Unit 3 (2).pdf
GayathriRHICETCSESTA
 
Smart material - Unit 3 (1).pdf
Smart material - Unit 3 (1).pdfSmart material - Unit 3 (1).pdf
Smart material - Unit 3 (1).pdf
GayathriRHICETCSESTA
 
oops with java modules iii & iv.pptx
oops with java modules iii & iv.pptxoops with java modules iii & iv.pptx
oops with java modules iii & iv.pptx
rani marri
 
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 Applet Introduction
java Applet Introductionjava Applet Introduction
java Applet Introduction
yugandhar vadlamudi
 
Appletsbjhbjiibibibikbibibjibjbibbjb.ppt
Appletsbjhbjiibibibikbibibjibjbibbjb.pptAppletsbjhbjiibibibikbibibjibjbibbjb.ppt
Appletsbjhbjiibibibikbibibjibjbibbjb.ppt
Vijay Bhaskar Thatty
 
Applets(1)cusdhsiohisdhfshihfsihfohf.ppt
Applets(1)cusdhsiohisdhfshihfsihfohf.pptApplets(1)cusdhsiohisdhfshihfsihfohf.ppt
Applets(1)cusdhsiohisdhfshihfsihfohf.ppt
Vijay Bhaskar Thatty
 
Java Applet presentation............pptx
Java Applet presentation............pptxJava Applet presentation............pptx
Java Applet presentation............pptx
ZaildarHussainFaisal
 
Graphics programming in Java
Graphics programming in JavaGraphics programming in Java
Graphics programming in Java
Tushar B Kute
 
java programming - applets
java programming - appletsjava programming - applets
java programming - applets
HarshithaAllu
 
Applets in Java. Learn java program with applets
Applets in Java. Learn java program with appletsApplets in Java. Learn java program with applets
Applets in Java. Learn java program with applets
halaplay385
 
oops with java modules iii & iv.pptx
oops with java modules iii & iv.pptxoops with java modules iii & iv.pptx
oops with java modules iii & iv.pptx
rani marri
 
Applet ppt for higher understanding education
Applet ppt for higher understanding educationApplet ppt for higher understanding education
Applet ppt for higher understanding education
BhanuPriya93439
 
Ad

More from Wani Zahoor (6)

VPN Network
VPN NetworkVPN Network
VPN Network
Wani Zahoor
 
Java threads
Java threadsJava threads
Java threads
Wani Zahoor
 
DotNet Framework
DotNet FrameworkDotNet Framework
DotNet Framework
Wani Zahoor
 
Deadlocks by wani zahoor
Deadlocks by wani zahoorDeadlocks by wani zahoor
Deadlocks by wani zahoor
Wani Zahoor
 
Antennas in Wireless Communication
Antennas in Wireless CommunicationAntennas in Wireless Communication
Antennas in Wireless Communication
Wani Zahoor
 
ADO.NET
ADO.NETADO.NET
ADO.NET
Wani Zahoor
 
DotNet Framework
DotNet FrameworkDotNet Framework
DotNet Framework
Wani Zahoor
 
Deadlocks by wani zahoor
Deadlocks by wani zahoorDeadlocks by wani zahoor
Deadlocks by wani zahoor
Wani Zahoor
 
Antennas in Wireless Communication
Antennas in Wireless CommunicationAntennas in Wireless Communication
Antennas in Wireless Communication
Wani Zahoor
 

Recently uploaded (19)

project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 

Applets in java

  • 1. Applets in Java Not Apples Presented By: Wani Zahoor
  • 2. Introduction  Applet is small java program that can be easily transported over the network from one computer to other.  used in internet applications.  embedded in an html page, can be downloaded from the server and run on the client, so as to do a specific kind of job.
  • 3. Types of Java Programmes  Standalone  Web based
  • 7. APPLET CLASS  java.applet.Applet is the super class of the all the applets.  Applet class has a predefined hierarchy
  • 8. Applet Example import java.applet.*; import java.awt.*; public class FirstApplet extends Applet { public void paint(Graphics g) { g.drawString(“Welcome in Applets”,10,50); } }
  • 10. Applet Life cycle  An applet may move from one state to another depending upon a set of default behaviours inherited in the form of methods from ‘Applet’ class.  These states are  Born  Running  Idle  Dead
  • 12. Life cycle of Applet  init() –  creates the objects needed by the applet;  sets up initial values, load font and images or set up colors.  called only once during the lifetime of on Applet.  start()-  moves to this phase automatically after the initialization state.  if the applet is stopped or it goes to idle state, start() method must be called in order to force the applet again to the running state.  paint() -  This method is called each time to draw and redraw the output of an applet.  stop()-  idle state, once it is stopped from running  destroy()-  An applet goes to dead state when it is destroyed by invoking the destroy() method of Applet class.  It results in complete removal of applet from the memory.
  • 13. Common Methods drawString()-  member of Graphics class, used to output a string to an applet.  It is typically called from within the paint() or update() method.  void drawString(String msg,int a, int b)  setBackground() & getBackground()  belongs to Component class, used to set and get the background color.  void setBackground(Color anyColor)  predefined constants for each color, such as Color.red can be used.  setForeground() & get Foreground()  set and gets the color of the text to be displayed on the foreground of the applet window.  void setForeground(Color anyColor)  showStatus()  display any string in the status window of the browser  void showString(String text)
  • 14. Graphics class import java.awt.* ; import java.applet.* ; public class DrawLineRect extends Applet { public void paint(Graphics g){ g.drawRect(10,60,40,30); g.fillRect(60,10,30,80); g.fillOval(140,160,170,170); g.drawRoundRect(10,100,80,50,10,10); g.fillRoundRect(20,110,60,30,5,5); g.drawArc(280,210,250,220,30,90); g.drawLine(100,10,230,140); g.drawLine(100,140,230,10); }}
  • 16. Now your turn..!!!  How to programme this…..????
  • 17. HTML Tag <applet code="Bubbles.class" width="350" height="350"> </applet>