Introduction to Java Programming by Upendra Kumar Tiwari

Introduction to Java Programming by Upendra Kumar Tiwari

Author:Upendra Kumar Tiwari [Tiwari, Upendra Kumar]
Language: eng
Format: azw3
Publisher: Acme Learning Private Limited
Published: 2011-01-29T16:00:00+00:00


c hapter11

Applet Programming

chapter objectives After studying this chapter, you should be able to: Understand Applet programming.

Learn about local and remote applet.

Compare applet from application.

Understand Applet Life Cycle.

11.1 INTRODUCTION In the previous chapters, we’ve been dealing with classes that contain a main method and run as standalone applications. Java code can also be executed under the control of a web browser. Code written to execute under the control of a browser is called an applet. Mini-applications, these applets have access to a subset of the normal Java network and file I/O access. Applets can be used to provide dynamic user-interfaces and a variety of graphical effects for web pages.

Applets are small Java programs that are embedded in Web pages. They can be transported over the Internet from one computer (web server) to another (client computers). They transform web into rich media and support the delivery of applications via the Internet.

Today, applets are being used to accomplish far more than demonstrative goals. There are working examples of applets on web sites throughout the Internet a check of the AltaVista search engine finds more than 4,200 Web pages that have applets embedded on them.

The current uses of applets include the following:

Tickertape-style news and sports headline updates

Animated graphics

Video games

Student tests

Image maps that respond to mouse movement

Advanced text displays

Database reports

11.1.1 Local and Remote Applet We can embed applets into web pages in two ways. One we can write our own applet and embed it into web page. Second we can download an applet from a remote computer and then embed it into a web page.

An applet developed locally and stored in a local system is known as Local applet as shown in figure11.1. When a web page is trying to find a local applet, it does not need to use the Internet and therefore, the local system does not require the network connection. It simply reaches the directories in the local system and locates and loads the specified applet.

Figure 11.1: Local applet A remote applet is the applet which is developed by someone else and stored on a remote computer connected to the Internet. If the system is connected to the Internet, we can download the remote applet onto our system via the internet and run it as shown in the figure 11.2.

Figure11.2: Remote applet In order to locate and load a remote applet, we must know the applet’s address on the web. This address is known as Uniform Resource Locator (URL) and must be specified in the applet’s HTML document as the value of codebase attribute.

Note: In the case of local applet, codebase may be absent or can specify a local directory.

11.2 HOW APPLET DIFFERS FROM APPLICATION?



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.