Applet Programming

Java can be used to creates two types of program:
1. Applications 
2. Applets
1. Java Application 
  • An application is program that runs on your computer, under the operating system of that computer.
  • That is, an application created by Java is more or less like one created using C or C++. 
2. Java Applet
  • An applet is a small Internet based program written in Java, which is designed to be transmitted over the internet can be downloaded by any computer across network Internet and executed by Java-compatible Web browser.
  • The applet is usually embedded in an HTML page on a Web site and can be executed within browser. 
1.1.1. Local and remote applets:

- There are two different types of applet.

- The applet types vary based on how the applet is embedded into web page.

Applet types are: 
1. Local Applet
2. Remote Applet
1. Local Applet:
- Local applet are stored in local system.
- The web browser will search the local system directories, find the local applet and execute it.
- Execution of local applet does not require internet connection. 


Local Applet

 - Specifying local applet



- The codebase attribute specifies a path on your system for the local applet, whereas the code attribute specifies the name of the byte-code file that contains the applet code.
-  The path specified in the codebase attribute is relative to the folder containing the HTML that references the applet.
 2.Remote Applet:
- The remote applets are stored in remote computer.
- The web browser requires internet connection to locate and load the remote applet form the remote computer.
- To access a remote applet in your Web page, you must know the applet's URL in order to display the applet correctly.
Remote applet
Specifying remote applet




The codebase attribute specifies a URL of remote system for the remote applet, whereas the code attribute specifies the name of the byte-code file that contains the applet's code.
- The only difference between accessing local and remote applet is thee value of the codebase attribute. In the local applet, codebase specifies a local folder, and in the remote applet, it specifies the URL at which the applet is located. 
1.1.2 Difference between Applet and Application:
- Following are the difference between Applet and Application program:
APPLET
APPLICATION
Applet does not require main() method to start execution.
Application program requires main() method to start its execution
Applet is embedded within webpage
Application can not be emebeddded within webpage.
Applet does not run independent.
Application runs independently.
Applet accept input through PARAM tag.
Application accept input through command line argument.
Applet executes under strict security restriction. It can not access the local file system.
Applet does not have strict security restriction. It can access local file system.

No comments:

Post a Comment

If any doubts, please let me know!!!

Applet life cycle

APPLET LIFE CYCLE: An applet pass through following states during  life cycle as shown in following figure: The applet class ...