Find Jobs
Hire Freelancers

Write some Articles

₹600-1500 INR

Lukket
Slået op cirka 8 år siden

₹600-1500 INR

Betales ved levering
What is Applet? An applet is a small Internet-based program written in Java, a programming language for the Web, which can be downloaded by any computer. The applet is also able to run in HTML. The applet is usually embedded in an HTML page on a Web site and can be executed from within a browser. Java applets run at very fast speeds and are comparable to other compiled languages such as C++, Java applets had run many times faster than JavaScript. Unlike JavaScript, Java applets had access to 3D hardware acceleration, making them well-suited for non-trivial, computation-intensive visualizations.   1) Applet Life Cycle Various states, an applet, under- goes between its object creation and object removal (when the job is over) is known as life cycle. Each state is represented by a method. There exist 5 states represented by 5 methods. That is, in its life of execution, the applet exists (lives) in one of these 5 states. These methods are known as "callback methods" as they are called automatically by the browser whenever required for the smooth execution of the applet. Programmer just writes the methods with some code but never calls. 1. Init() method 2. start() method 3. paint() method 4. stop() method 5. destroy() method These methods are known as life cycle methods. These methods are defined in [login to view URL] class except paint() method. The paint() method is defined in [login to view URL] class, an indirect super class of Applet. Browser Responsibilities The life cycle methods are called as callback methods as they are called implicitly by the browser for the smooth execution of the applet. Browser should provide an environment known as container for the execution of the applet. Following are the responsibilities of the browser. 1. It should call the callback methods at appropriate times for the smooth execution of the applet. 2. It is responsible to maintain the life cycle of the applet. 3. It should have the capability to communicate between applets, applet to JavaScript and HTML, applet to browser etc. Description of Life Cycle methods Even though, the methods are called automatically by the browser, the programmer should know well when they are called and what he can do with the methods. Following is the schematic representation of the methods. Brief Description of Life Cycle Methods Following is the brief description of the above methods. 1. Init(): The applet's voyage starts here. In this method, the applet object is created by the browser. Because this method is called before all the other methods, programmer can utilize this method to instantiate objects, initialize variables, setting background and foreground colors in GUI etc.; the place of a constructor in an application. It is equivalent to born state of a thread. 2. Start(): In Init() method, even through applet object is created, it is in inactive state. An inactive applet is not eligible for microprocessor time even though the microprocessor is idle. To make the applet active, the Init() method calls start() method. In start() method, applet becomes active and thereby eligible for processor time. 3. Paint(): This method takes a [login to view URL] object as parameter. This class includes many methods of drawing necessary to draw on the applet window. This is the place where the programmer can write his code of what he expects from applet like animation etc. This is equivalent to runnable state of thread. 4. stop(): In this method the applet becomes temporarily inactive. An applet can come any number of times into this method in its life cycle and can go back to the active state (paint() method) whenever would like. It is the best place to have cleanup code. It is equivalent to the blocked state of the thread. 5. destroy(): This method is called just before an applet object is garbage collected. This is the end of the life cycle of applet. It is the best place to have cleanup code. It is equivalent to the dead state of the thread. After knowing the methods, let us know when they are called by the browser. • init() method is called at the time of starting the execution. This is called only once in the life cycle. • start() method is called by the init() method. This method is called a number of times in the life cycle; whenever the applet is deiconifed , to make the applet active. • paint() method is called by the start() method. This is called number of times in the execution. • stop() method is called whenever the applet window is iconified to inactivate the applet. This method is called number of times in the execution. • destroy() method is called when the applet is closed. This method is called only once in the life cycle. Observe, the init() and destroy() methods are called only once in the life cycle. But, start(), paint() and stop() methods are called a number of times.
Projekt-ID: 10229212

Om projektet

3 forslag
Projekt på afstand
Aktiv 8 år siden

Leder du efter muligheder for at tjene penge?

Fordele ved budafgivning på Freelancer

Fastsæt dit budget og din tidsramme
Bliv betalt for dit arbejde
Oprids dit forslag
Det er gratis at skrive sig op og byde på jobs
3 freelancere byder i gennemsnit ₹1.100 INR på dette job
Brug Avatar.
A proposal has not yet been provided
₹1.250 INR på 2 dage
0,0 (0 anmeldelser)
0,0
0,0

Om klienten

Flag for INDIA
India
0,0
0
Medlem siden apr. 8, 2016

Klientverificering

Tak! Vi har sendt dig en e-mail med et link, så du kan modtage din kredit.
Noget gik galt, da vi forsøgte at sende din mail. Prøv venligst igen.
Registrerede brugere Oprettede jobs i alt
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Indlæser forhåndsvisning
Geolokalisering er tilladt.
Din session er udløbet, og du er blevet logget ud. Log venligst ind igen.