views:

30

answers:

1

How can I detect whether a java-applet has been loaded successfully without polling the browser /using setTimout ?

Is there any event that I can bind to?

The problem is: there is a pop up asking the user whether he trusts the applet or not, and that takes a few seconds until the user clicks "Yes" ,meanwhile my code fails to execute because the applet has not been loaded.

+1  A: 

You mean from javascript ? You can ask the applet. Have it set a boolean to true in init(), and return this in a method you call ... oh wait, you wrote "without using setTimeout". Well, in this case, I guess you have to go the other way around, and have your applet call a javascript method (for instance with JSObject.getWindow(this);)... But I think this is more difficult/bug prone than using a timer until the applet is loaded.

Damien
@Damien I ended up using the timer to tell when the applet has been loaded, it is simpler than the other option
portoalet