程旭媛 发表于 2013-8-16 16:38:30

[Oracle interview]Can applets communicate with each other?

龚城师 发表于 2013-8-16 16:43:28

At thispoint in time applets may communicate with other applets running in the samevirtual machine. If the applets are of the same class, they can communicatevia shared static variables. If the applets are of different classes, theneach will need a reference to the same class with static variables. In anycase the basic idea is to pass the information back and forth through astatic variable.An applet can also get references to all other applets on thesame page using the getApplets() method of java.applet.AppletContext. Onceyou get the reference to an applet, you can communicate with it by using itspublic members.It is conceivable to have applets in different virtualmachines that talk to a server somewhere on the Internet and store any datathat needs to be serialized there. Then, when another applet needs this data,it could connect to this same server. Implementing this is non-trivial.
页: [1]
查看完整版本: [Oracle interview]Can applets communicate with each other?