SlideShare una empresa de Scribd logo
1 de 15
Applet Execution




                   1
Objectives

On completion of this period, you will be able to
  learn
• Applet execution




                                                    2
Recap

In the last class ,we have studied about
• How to write a simple applet program
• We have learned the importance of each
  statement in the applet program
• Let’s learn how to execute an applet




                                           3
Applet Execution

• Applets do not begin execution at
   • main( )
• Instead, an applet begins execution when the
  name of its class is passed to an applet viewer
  or to a web browser




                                                    4
Applet Execution            contd..

• The steps in execution of an applet program
  • Type and save the applet program with a text
    editor
  • Compile in the same way that you have been
    compiling other Java programs
  • However, running SimpleApplet involves a
    different process




                                                   5
Applet Execution         contd..

•  Two ways to run an applet:
  1. Executing the applet within a Java-
      compatible web browser
  2. Using appletviewer
• An applet viewer executes your applet in a
   window
• This is generally the fastest and easiest way
   to test your applet


                                                  6
Applet Execution       contd..

• To execute an applet in a Web browser, you
  need to write a short HTML file
• That contains the APPLET tag
• Here is the HTML file that executes
• SimpleApplet:
• <applet code="SimpleApplet" width=200
  height=60>
• </applet>

                                               7
Applet Execution         contd..

• The width and height arguments specify the
  dimensions of the display area used by the
  applet
• After you create this file, you can execute your
  applet through web browser
• By loading this file, in the browser the
  SimpleApplet program will be to be executed




                                                     8
Applet Execution         contd..
• To execute SimpleApplet with an applet viewer,
  you may also execute the HTML file shown
  earlier
• For example, if the preceding HTML file is called
  RunApp.html
• Then the following command line will run
  SimpleApplet
• C:>appletviewer RunApp.html



                                                  9
Applet Execution             contd..
• There is another approach to execute applet
  using appletviewer
• The steps are
  • Write the applet tag in the applet program itself inside
    comments
  • Write and save the applet program
  • Compile as usual
  • Execute applet using the following command
     • appletviewer SimpleApplet.java



                                                           10
Applet Execution           contd..
SimpleApplet source file looks like this:
import java.awt.*;
import java.applet.*;
/*
<applet code="SimpleApplet" width=200 height=60>
</applet>
*/
public class SimpleApplet extends Applet {
   public void paint(Graphics g) {
       g.drawString("A Simple Applet", 20, 20);
   }
}


                                                   11
Summary

     In this class, you have learnt
•   Applets do not need a main( ) method
•   Applets must be run under an applet viewer or a
    Java-compatible browser
•   User I/O is not accomplished with Java’s stream
    I/O classes
•   Instead, applets use the interface provided by
    the AWT to interact with user


                                                  12
Frequently Asked Questions

• Write the different steps involved in Applet
  execution




                                                 13
Quiz

1. Appletviewer tool is provided by JDK only test
    the applet during the development of applet
   1. true
   2. false




                                                    14
Quiz

2. Is executing an applet using an appletviewer
    is fastest and easiest way to test your applet
   – yes
   – no




                                                     15

Más contenido relacionado

La actualidad más candente (20)

Appl clas nd architect.56
Appl clas nd architect.56Appl clas nd architect.56
Appl clas nd architect.56
 
6.applet programming in java
6.applet programming in java6.applet programming in java
6.applet programming in java
 
L18 applets
L18 appletsL18 applets
L18 applets
 
27 applet programming
27  applet programming27  applet programming
27 applet programming
 
Applets
AppletsApplets
Applets
 
applet using java
applet using javaapplet using java
applet using java
 
Java applets
Java appletsJava applets
Java applets
 
Java applets
Java appletsJava applets
Java applets
 
Java applets
Java appletsJava applets
Java applets
 
Java applet basics
Java applet basicsJava applet basics
Java applet basics
 
Java Applet
Java AppletJava Applet
Java Applet
 
Java Applet
Java AppletJava Applet
Java Applet
 
Java applets
Java appletsJava applets
Java applets
 
Applet progming
Applet progmingApplet progming
Applet progming
 
Java applet - java
Java applet - javaJava applet - java
Java applet - java
 
Applet programming
Applet programming Applet programming
Applet programming
 
JAVA APPLETS
JAVA APPLETSJAVA APPLETS
JAVA APPLETS
 
Lecture1 oopj
Lecture1 oopjLecture1 oopj
Lecture1 oopj
 
Appletjava
AppletjavaAppletjava
Appletjava
 
Java applets
Java appletsJava applets
Java applets
 

Similar a Applet execution (20)

Applets in Java
Applets in JavaApplets in Java
Applets in Java
 
APPLET.pptx
APPLET.pptxAPPLET.pptx
APPLET.pptx
 
Jsp applet
Jsp appletJsp applet
Jsp applet
 
JAVA APPLET BASICS
JAVA APPLET BASICSJAVA APPLET BASICS
JAVA APPLET BASICS
 
Applet.pptx
Applet.pptxApplet.pptx
Applet.pptx
 
Applet1 (1).pptx
Applet1 (1).pptxApplet1 (1).pptx
Applet1 (1).pptx
 
Dacj 2-2 a
Dacj 2-2 aDacj 2-2 a
Dacj 2-2 a
 
Applet
AppletApplet
Applet
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programming
 
Java introduction
Java introductionJava introduction
Java introduction
 
Applets_Basic Introduction
Applets_Basic IntroductionApplets_Basic Introduction
Applets_Basic Introduction
 
Advanced Programming, Java Programming, Applets.ppt
Advanced Programming, Java Programming, Applets.pptAdvanced Programming, Java Programming, Applets.ppt
Advanced Programming, Java Programming, Applets.ppt
 
Java applet
Java appletJava applet
Java applet
 
Basicsofapplets 53-130303003217-phpapp02
Basicsofapplets 53-130303003217-phpapp02Basicsofapplets 53-130303003217-phpapp02
Basicsofapplets 53-130303003217-phpapp02
 
Java applet
Java appletJava applet
Java applet
 
Java Applets
Java AppletsJava Applets
Java Applets
 
applet.pptx
applet.pptxapplet.pptx
applet.pptx
 
B.Sc. III(VI Sem) Advance Java Unit2: Appet
B.Sc. III(VI Sem) Advance Java Unit2: AppetB.Sc. III(VI Sem) Advance Java Unit2: Appet
B.Sc. III(VI Sem) Advance Java Unit2: Appet
 
Applets
AppletsApplets
Applets
 
PROGRAMMING IN JAVA- unit 4-part I
PROGRAMMING IN JAVA- unit 4-part IPROGRAMMING IN JAVA- unit 4-part I
PROGRAMMING IN JAVA- unit 4-part I
 

Más de myrajendra (20)

Fundamentals
FundamentalsFundamentals
Fundamentals
 
Data type
Data typeData type
Data type
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1
 
Jdbc workflow
Jdbc workflowJdbc workflow
Jdbc workflow
 
2 jdbc drivers
2 jdbc drivers2 jdbc drivers
2 jdbc drivers
 
3 jdbc api
3 jdbc api3 jdbc api
3 jdbc api
 
4 jdbc step1
4 jdbc step14 jdbc step1
4 jdbc step1
 
Dao example
Dao exampleDao example
Dao example
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
Internal
InternalInternal
Internal
 
3. elements
3. elements3. elements
3. elements
 
2. attributes
2. attributes2. attributes
2. attributes
 
1 introduction to html
1 introduction to html1 introduction to html
1 introduction to html
 
Headings
HeadingsHeadings
Headings
 
Forms
FormsForms
Forms
 
Css
CssCss
Css
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Views
ViewsViews
Views
 
Starting jdbc
Starting jdbcStarting jdbc
Starting jdbc
 

Último

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 

Último (20)

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 

Applet execution

  • 2. Objectives On completion of this period, you will be able to learn • Applet execution 2
  • 3. Recap In the last class ,we have studied about • How to write a simple applet program • We have learned the importance of each statement in the applet program • Let’s learn how to execute an applet 3
  • 4. Applet Execution • Applets do not begin execution at • main( ) • Instead, an applet begins execution when the name of its class is passed to an applet viewer or to a web browser 4
  • 5. Applet Execution contd.. • The steps in execution of an applet program • Type and save the applet program with a text editor • Compile in the same way that you have been compiling other Java programs • However, running SimpleApplet involves a different process 5
  • 6. Applet Execution contd.. • Two ways to run an applet: 1. Executing the applet within a Java- compatible web browser 2. Using appletviewer • An applet viewer executes your applet in a window • This is generally the fastest and easiest way to test your applet 6
  • 7. Applet Execution contd.. • To execute an applet in a Web browser, you need to write a short HTML file • That contains the APPLET tag • Here is the HTML file that executes • SimpleApplet: • <applet code="SimpleApplet" width=200 height=60> • </applet> 7
  • 8. Applet Execution contd.. • The width and height arguments specify the dimensions of the display area used by the applet • After you create this file, you can execute your applet through web browser • By loading this file, in the browser the SimpleApplet program will be to be executed 8
  • 9. Applet Execution contd.. • To execute SimpleApplet with an applet viewer, you may also execute the HTML file shown earlier • For example, if the preceding HTML file is called RunApp.html • Then the following command line will run SimpleApplet • C:>appletviewer RunApp.html 9
  • 10. Applet Execution contd.. • There is another approach to execute applet using appletviewer • The steps are • Write the applet tag in the applet program itself inside comments • Write and save the applet program • Compile as usual • Execute applet using the following command • appletviewer SimpleApplet.java 10
  • 11. Applet Execution contd.. SimpleApplet source file looks like this: import java.awt.*; import java.applet.*; /* <applet code="SimpleApplet" width=200 height=60> </applet> */ public class SimpleApplet extends Applet { public void paint(Graphics g) { g.drawString("A Simple Applet", 20, 20); } } 11
  • 12. Summary In this class, you have learnt • Applets do not need a main( ) method • Applets must be run under an applet viewer or a Java-compatible browser • User I/O is not accomplished with Java’s stream I/O classes • Instead, applets use the interface provided by the AWT to interact with user 12
  • 13. Frequently Asked Questions • Write the different steps involved in Applet execution 13
  • 14. Quiz 1. Appletviewer tool is provided by JDK only test the applet during the development of applet 1. true 2. false 14
  • 15. Quiz 2. Is executing an applet using an appletviewer is fastest and easiest way to test your applet – yes – no 15