Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Topic 1 Applets
Presentation 1
Revision
Objectives
At the end of this presentation, you will be able to : Explain applet programming List the differences between applications and applets Describe the different stages in the life cycle of an applet
Java Programs
Java supports two kinds of programs.
Java Applications are the normal standalone programs.
Java Applets are the programs that are to be embedded in a Web page.
Applet Programming
Applets are the Java programs that are executed by the Web browser. Appletviewer is a Java utility to execute applets.
Applet is a special class file written to display graphics in a Web browser.
Applets
Applets are embedded in Web pages using the HTML tag <APPLET>. When a Web page containing applet program is run, it is downloaded to the memory automatically and executed by the Web browser.
Applet gets displayed in the specific space allocated in the Web page called Applet Window.
Applets
Applets can contain embedded objects like :
Animated graphics Video games Advanced text displays and images Audio
Applet Types
Local Applets
Remote Applets
These can be downloaded and embedded into Web pages from the Internet.
Local Applets
Remote Applets
4. destroy()
init()
Initialisation State
This method is executed when it is first loaded into the memory.
init()
Syntax
start()
Running State
The start() method of the Applet Class is executed whenever an applet is started or restarted.
start()
Syntax
stop()
Idle State
stop()
Syntax
destroy()
Dead State
The destroy() method is executed when a Web page is closed.
destroy()
Syntax
paint()
The paint() method of the Applet class is executed automatically whenever the applet is displayed in the Web page. This method is used to draw graphics in the drawing area of the applet.
repaint()
The repaint() method is used whenever you want to redraw the applets drawing area. The repaint() method calls the update() method. The update() method clears the applet area and calls the paint() method.
paint()
Syntax
Summary
In this presentation, you learnt the following
Applets are Java programs mainly used in Internet computing.
The applets output is displayed within a subset of the display area of the browser.
Java applet inherits a set of default properties from the Applet class.
Summary
In this presentation, you learnt the following
Applet enters the running state when the start() method of Applet class is invoked. An applet becomes idle when it is stopped from running.