Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q4074 Can one applet load another applet on runtime, and can these two applets talk?

You are here: irt.org | FAQ | Java | Q4074 [ previous next ]

Yes one applet can load another applet.

And since you need both the applet to communicate, you need to have both applets in the same page. But the problem in this case is that both the applets will load independently of each other. You can control the behaviour of the other applet from the first one. But your requirement is of loading the another applet from the first one.

You can have two frames in a page . In one frame there will be your first applet which will load automatically when the page is loaded. And the other frame will contain a blank page. Now on certain event in the first applet you can use "this.showDocument("URL") " to make a call to another applet which you want to load. Give the target parameter as the other frame. (You will have to give the name of the other frame) Now when these two applets are loaded they can exchange data in their life time.

©2018 Martin Webb