小应用程序间的通信 [英] Inter applet communication

查看:126
本文介绍了小应用程序间的通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的理解每个小程序是独立的实体。是有可能有
小应用程序间的通信? 。如果是这样,如何​​能够实现?

In my understanding each applets are independent entities . Is it possible to have inter applet communication ? . If so , how it could be achieved ?

谢谢
Ĵ

推荐答案

是的。它能够实现小程序间的通信,如果它们是相同的页面和始发来自相同域上。您必须使用属性名称=值之类的名字在第一页的小程序:

Yes. It is possible to achieve inter-applet communication if they are on the same page and originating from the same domain. You will have to name the applets in the page first using the attribute "name=value" like:

<applet code="FirstApplet.class" name="firstApplet" width=nn height=nn></applet>
<applet code="SecondApplet.class" name="secondApplet" width=nn height=nn></applet>

以上到位,FirstApplet.java,使用以下方法来访问SecondApplet:

with above in place, in FirstApplet.java, use the following to access SecondApplet:

SecondApplet secondApplet =
         (SecondApplet)getAppletContext().getApplet("secondApplet");
//invoke a method on secondApplet here

同样,您可以访问FirstApplet在SecondApplet.java

Similarly, you can access the FirstApplet in SecondApplet.java

这篇关于小应用程序间的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆