Your SlideShare is downloading. ×
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Applet execution
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Applet execution

1,457

Published on

This ppt describes how the applet executes:-

This ppt describes how the applet executes:-

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,457
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Applet Execution 1
  • 2. ObjectivesOn completion of this period, you will be able to learn• Applet execution 2
  • 3. RecapIn 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. Quiz1. Appletviewer tool is provided by JDK only test the applet during the development of applet 1. true 2. false 14
  • 15. Quiz2. Is executing an applet using an appletviewer is fastest and easiest way to test your applet – yes – no 15

×