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