Tuesday, 7 April 2020

Inter Applet Communication

What is Inter Applet Communication ?

Inter Applet Communication means the communication of applets to each other in the same browser running simultaneously.
Lets understand it by an example:
suppose if there are 2 applets running in the browser that are applet1 and applet2.
Now suppose we want that when we click on the applet1's button then a message should be displayed on applet2
by using Inter Applet Communication we can do that thing and all those things that are related with the applet's communication.

Now the question is how can we do that?

so java.applet.AppletContext class provides the facility of communication between applets.
we provide the name of applets in the html file and by using this particular name with getApplet() method we can access the particular applet.

Syntax of getApplet() method:

public Applet getApplet(String appletName);

Program

first I am creating the html file named iac.html
<html>
<head>
<title>inter applet communication</title>
</head>
<body>
<applet code="Applet1.class" width="1000" height="500" name="applet1">
</applet>
<hr/>
<applet code="Applet2.class" width="1000" height="500" name="applet2">
</applet>
</body>
</html>

Applets

What is an Applet in java?
  • Applet is an special java program that runs on the client's machine's browser.
  • Applets are used to generate dynamic contents on the web page.
Today Applets are replaced by the java's Servlet but remember one thing that Servlet are not on client side but they are server side whereas Applets are client side.

what is meant by server side and client side?

What are the advantages and disadvantages of Applets?

Advantage of Applet

There are many advantages of applet. They are as follows:
  • It works at client side so less response time.
  • Secured
  • It can be executed by browsers running under many platforms, including Linux, Windows, Mac Os etc.

Drawback of Applet

  • Plugin is required at client browser to execute applet.

What is BAT?