Presentation is loading. Please wait.

Presentation is loading. Please wait.

APPLET PROGRAMMING.

Similar presentations


Presentation on theme: "APPLET PROGRAMMING."— Presentation transcript:

1 APPLET PROGRAMMING

2 MEANING OF APPLET Applets are small java programs.
They are used in Internet Programming. Applet can run using the Applet viewer or any web browser. Its like an application program and perform arithmetic operations, display graphics, accept user input, create animation etc.,

3 TYPES OF APPLET There are two categories of Applet: 1. Local applet
2. Remote Applet

4 1.Local Applet: An Applet developed locally and
stored in a local system is known as a “local applet”. It doesn't need Internet connection.

5 2.Remote Applet: A Remote Applet is developed by someone
else and stored on remote computer connected to the internet. If the system is connected to the internet only then remote applets can be downloaded for use.

6 APPLET LIFE CYCLE Applet as the following states:
Born on Initialization state. Running state Display state Idle state Dead or Destroyed state

7

8 Initialization State An Applet when loaded it is on its initialization state. At this state init() method of class Applet is called. This is the new born state of an applet. At this stage, Objects can be created those are needed by the applet. Initial vales are specified. Images are loaded. Font colors are set up for Applet. Public void init () { -- }

9 Running State Applet enters the running state when the system calls the start() method of Applet class This occurs automatically after the applet is initialized. Start() method can be called more than one time. Public void start() { -- --- }

10 Display State Applet moves to the display state when it has to perform some output operations on the screen. This happens when applet is in running state. The paint() method perform this task. public void paint(Graphics g) { -- --- }

11 Idle State An Applet becomes idle when it is stopped from running.
Stopping occurs automatically when someone leave the page containing the running applet. An applet will send to idle state by explicitly calling stop() method. Public void stop() { -- --- }

12 Dead State An applet is said to be dead when it is removed from memory. This happens automatically by invoking destroy() method ,when someone quit the browser. public void destroy() { -- --- }

13 Difference between Applets and Application
Applets do not use main() method like other applications. Applets can not perform read or write operations in files of local computer. Applets can not run independently, they run with the help of HTML tags. Applets are restricted from using libraries from other languages such as C or C++.

14 Example: import java. applet. ; import java. awt
Example: import java.applet.*; import java.awt.*; public class MyApplet1 extends Applet { public void init() { //initialization code } public void start() { // start code } public void paint(Graphics g) { // output operation. } public void stop() { // stop code } public void destroy() { // destroy code } }


Download ppt "APPLET PROGRAMMING."

Similar presentations


Ads by Google