SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Appl clas nd architect.56
Appl clas nd architect.56Appl clas nd architect.56
Appl clas nd architect.56
myrajendra
 
6.applet programming in java
6.applet programming in java6.applet programming in java
6.applet programming in java
Deepak Sharma
 
Java applets
Java appletsJava applets
Java applets
lopjuan
 
Java applet basics
Java applet basicsJava applet basics
Java applet basics
Sunil Pandey
 

Tendances (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
 

Similaire à Applet execution

Basicsofapplets 53-130303003217-phpapp02
Basicsofapplets 53-130303003217-phpapp02Basicsofapplets 53-130303003217-phpapp02
Basicsofapplets 53-130303003217-phpapp02
Swati Jadhav
 

Similaire à 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
 

Plus 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
 

Dernier

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Dernier (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 

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