Java Presentation

8,191 views
7,905 views

Published on

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

No Downloads
Views
Total views
8,191
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
268
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Java Presentation

  1. 1. WELCOME JAVA PRESENTATION
  2. 2. TOPIC OF PRESENTATION <ul><li>APPLET </li></ul><ul><li>Created By : </li></ul><ul><li>Prashant Marvania </li></ul>
  3. 3. Overview of APPLET <ul><li>What is Applet? </li></ul><ul><li>Advantages of Applet </li></ul><ul><li>Disadvantages of Applet </li></ul><ul><li>The Life Cycle of an Applet </li></ul><ul><li>The format of <APPLET> tag </li></ul><ul><li>Attributes of the <APPLET> tag </li></ul><ul><li>Example of an Applet </li></ul>
  4. 4. What is Applet? <ul><li>Applet is a JAVA programme that can be embedded into HTML page. </li></ul><ul><li>JAVA Applet runs on the java enables web browsers such as MOZILA and INTERNET EXPLORER. </li></ul><ul><li>Applets are used to make the web site more dynamic and entertaining. </li></ul>
  5. 5. Advantages of Applet <ul><li>There are many advantages of Applet: </li></ul><ul><li>Cross platform and can run on Windows, MacOS and Linux platform. </li></ul><ul><li>Applet can work all the version of java plugin. </li></ul><ul><li>Applets run in a sandbox. </li></ul><ul><li>Applets are supported by most web browsers. </li></ul><ul><li>Applets are cached in most web browsers. </li></ul>
  6. 6. Disadvantages of Applet <ul><li>There are many disadvantages of Applet: </li></ul><ul><li>Java plug-in is required to run Applet. </li></ul><ul><li>Java Applet requires JVM. </li></ul><ul><li>If Applet is not already cached in the machine, it will be downloaded from internet and will take time. </li></ul><ul><li>Its difficult to design and build good user interface in Applets compared to HTML technology. </li></ul>
  7. 7. The Life Cycle of an Applet <ul><li>In Applet, there are 4 methods in Life Cycle: </li></ul><ul><li>1.init() </li></ul><ul><li>2.start() </li></ul><ul><li>3.stop() </li></ul><ul><li>4.destroy() </li></ul>
  8. 8. Init() and start() methods <ul><li>Init(): </li></ul><ul><li>This method is called to initialized an </li></ul><ul><li>Applet. </li></ul><ul><li>Start(): </li></ul><ul><li>This method is called after the </li></ul><ul><li>initialization of the Applet. </li></ul>
  9. 9. Stop() and destroy() methods <ul><li>Stop(): </li></ul><ul><li>This method can be called multiple </li></ul><ul><li>times in the life cycle of an Applet. </li></ul><ul><li>Destroy(): </li></ul><ul><li>This method is called only once in </li></ul><ul><li>the life cycle of an Applet when Applet </li></ul><ul><li>is destroyed </li></ul>
  10. 10. The format of <APPLET> tag <ul><li><APPLET attributes> </li></ul><ul><li>applet_parameters </li></ul><ul><li>alternate_content </li></ul><ul><li></APPLET> </li></ul>
  11. 11. Attributes of the <APPLET> tag <ul><li>There are many attributes of the <APPLET> tag. </li></ul><ul><li>1.CODE = appletFile </li></ul><ul><li>2.WIDTH = pixels </li></ul><ul><li>3.HEIGHT = pixels </li></ul>
  12. 12. Example of an Applet <ul><li>import javax.swing.*; </li></ul><ul><li>import java.awt.*; </li></ul><ul><li>import java.applet.*; </li></ul><ul><li>/* </li></ul><ul><li><applet code=“ImageEx” height=100 width=100> </li></ul><ul><li></applet> </li></ul><ul><li>*/ </li></ul><ul><li>public class ImageEx extends Applet </li></ul><ul><li>{ </li></ul><ul><li>public void paint( Graphics g ) </li></ul><ul><li>{ </li></ul><ul><li>Image img = getImage( getCodeBase( ), “ Lion.jpg&quot; ); </li></ul><ul><li>g.drawImage( img, 0,0, this ); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>RUN THE APPLET: </li></ul><ul><li>javac ImageEx.java </li></ul><ul><li>appletviewer ImageEx.java </li></ul>
  13. 13. Output of a programme
  14. 14. TOPIC OF PRESENTATION <ul><li>PACKAGE </li></ul><ul><li>Created By : </li></ul><ul><li>Prashant Marvania </li></ul>
  15. 15. Packages <ul><li>A package is a grouping of related types providing access protection and name space management. </li></ul><ul><li>Types are special kinds of classes and interfaces. </li></ul>
  16. 16. <ul><li>You should bundle these classes and the interface in package for several reasons. </li></ul><ul><li>1.You and other programmers can easily determine that these types are related. </li></ul><ul><li>2.You and other programmers where to find types that can provide graphics-related functions. </li></ul><ul><li>3.The name of your won’t conflict with the type names in other packages. </li></ul><ul><li>4.You can allow types within the package to have unrestricted access to one another yet still restrict access for types outside the package. </li></ul>
  17. 17. Creating a Package <ul><li>To create package, you choose a name for the package and put a package statement with that name the top of every source file that contains the types that you want to include in the package. </li></ul>
  18. 18. Naming a Package <ul><li>With programmers worldwide writing classes and interfaces using the java programming language, it is likely that many programmers will use the same name for different types. </li></ul>
  19. 19. Naming Conventions <ul><li>Package names are written in all lowercase to avoid conflict the names of classes or interfaces. </li></ul><ul><li>Companies use their reversed internet domain name to begin their package names. </li></ul><ul><li>Package in the java language itself begin with java or javax. </li></ul>
  20. 20. Using package members <ul><li>To use a public package member from outside its package. you must do one : </li></ul><ul><li>1.Refer to the member by its fully qualified name. </li></ul><ul><li>2.Import the package member. </li></ul><ul><li>3.Import the member’s entire package. </li></ul>
  21. 21. Refer to package <ul><li>Graphics. Rectangle </li></ul><ul><li>You could use this name to create an instance of graphics. Rectangle </li></ul><ul><li>Graphics. Rectangle myrect=new Graphics. Rectangle (); </li></ul>
  22. 22. Import a package member <ul><li>To import a specific member into the current file, put an import statement at the beginning of the file before any type definitions but after the package statement, if there is one. </li></ul><ul><li>Import graphics. Rectangle; </li></ul>
  23. 23. Import entire package <ul><li>To import all the types contained in a particular package, use the import statement with asterisk(*) wildcard character. </li></ul><ul><li>Import graphics.*; </li></ul>
  24. 24. Managing source and class files <ul><li>Many implementations of the java platform rely on hierarchical file systems to manage source and class files, although the java language specification does not require this. </li></ul>
  25. 25. <ul><li>The qualified name of the package member and the path name to the file are parallel, assuming the Microsoft windows file name separator backslash. </li></ul><ul><li>Class name graphics. Rectangle </li></ul><ul><li>Pathname to file graphicsRectangle. java </li></ul>
  26. 26. <ul><li>Each component of the package name corresponds to a subdirectory. </li></ul><ul><li>It would be contained in a series of subdirectories like this: </li></ul><ul><li>… comexamplegraphicsReactangle.java </li></ul>
  27. 27. <ul><li>A class path may include several paths, separated by a semicolon (windows) or colon (UNIX). </li></ul><ul><li>By default the compiler and the jvm search the current directory and the jar file containing the java platform classes so that these directories are automatically in your class path. </li></ul>
  28. 28. <ul><li>THANK YOU </li></ul>

×