how to know when all the applets have been loaded ?

J

JFA

Hi !
I have several applets on the same Web page and I want to make them
communicate between them. They share some static fields thanks to a system
of events sent by applets "dispatchers" to applets"listeners".

Everything work fine if I use a button to launch the operation.

But I can't do the same from the init() or start() methods, since
getApplets() don't list all the applets present on the page (some of them
have not time enough to load).

I've searched on many faqs without success.

Is there any trick to know when the whole page is completely loaded ?

thanks
 
A

Andrew Thompson

I have several applets on the same Web page
URL?

..and I want to make them
communicate between them. They share some static fields thanks to a system
of events sent by applets "dispatchers" to applets"listeners".

Everything work fine if I use a button to launch the operation.

But I can't do the same from the init() or start() methods, since
getApplets() don't list all the applets present on the page (some of them
have not time enough to load).

You put them on the page, so you do not need getApplets()
to know they are there, perhaps instead you should try to
gain a refernece to the applets by name, and then check
Applet.isAlive()

Do this in a looped thread until all applets have appeared
and you are in business.

HTH
 
T

Thomas Hawtin

JFA said:
I have several applets on the same Web page and I want to make them
communicate between them. They share some static fields thanks to a system
of events sent by applets "dispatchers" to applets"listeners".

IIRC, the relationship between web pages and class loader contexts is
not well defined. In any case, I think you are better off avoiding
static variables.
Everything work fine if I use a button to launch the operation.

But I can't do the same from the init() or start() methods, since
getApplets() don't list all the applets present on the page (some of them
have not time enough to load).

I've searched on many faqs without success.

Is there any trick to know when the whole page is completely loaded ?

Can't you just have each one check for all the others in their init()
method?

Tom Hawtin
 
M

Missaka Wijekoon

JFA said:
Hi !
I have several applets on the same Web page and I want to make them
communicate between them. They share some static fields thanks to a system
of events sent by applets "dispatchers" to applets"listeners".

Everything work fine if I use a button to launch the operation.

But I can't do the same from the init() or start() methods, since
getApplets() don't list all the applets present on the page (some of them
have not time enough to load).
Create a form field for each applet in the html page. When each applet
is initialized, set its respective html form field from 0 to 1. Each of
the applets can iterate through the form fields and know when they are
initialized.
 
J

JFA

many thanks to all of you for your very interesting advices.
I'll try it and choose the best.
jf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top