How to communicate between applet and an applet ?

How to communicate between applet and an applet ?

Sometimes you need to allow two or more applets to communicate on the Web page.

 Because the applets all run within the same Java context-that is, they are all in the same virtual machine together-appletscan invoke each other\'s methods.

The AppletContext class has some methods for locating another applet by name, or retrieving all the applets in the currentruntime environment. The AppletContext class in the java.applet package contains the two member functions getApplet and getApplets.

 By using these functions, an applet can find other applets and invoke methods on them.

 Example:Html file: Using the name attribute, you can refer to a applet: Applet anotherApplet = getApplet(\"applet1\"); anotherApplet.someMethod(); //calling any public method


By:Jalees
Date:2013-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher