[5824] in java-interest

home help back first fref pref prev next nref lref last post

Applet Contexts with Netscape

daemon@ATHENA.MIT.EDU (Jean-Michel Pulfer)
Wed Feb 28 15:57:36 1996

Date: Wed, 28 Feb 1996 20:15:21 +0100
To: java-interest@java.sun.com
From: Jean-Michel Pulfer <jmp@jstechno.ch>

I would like to implement a simple inter-applet communication between
applets laying on the same document. I have several Applets in one HTML
document, each having the same class,  and I would like to be able to create
an object (a class inheriting, say, from Thread) that "governs" my applets.

So far, I have tried two tricks, each working under Applet Viewer 1.0 (and
1.0b1  for Macintosh), but not working with Netscape 2.0

1) I do a "getAppletContext()", then enumerate through applets in order to
find each of my "sister" applets. The first who does this creates the
governing object and the other follow.

2) I use a static reference which I initialize to null and then examine in
my init() method (yes, it IS synchronized).

Under Netscape 2.0, each applet seems to live in a separate virtual machine
(i.e. a "static" variable is not, as it should, shared between instances of
the same applet in the same document). And getAppletContext().getApplets()
returns an empty enumeration.

Side note: why is this that I sometimes receive a null from
Enumeration.nextElement() ?

Thanks for ideas or confirmations of my findings,

Regards,
Jean-Michel

-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post