aspose file tools*
The moose likes Applets and the fly likes Using JSObject in Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Using JSObject in Applet" Watch "Using JSObject in Applet" New topic
Author

Using JSObject in Applet

pavan in
Ranch Hand

Joined: Oct 22, 2002
Posts: 64
I have an JApplet which uses an helper class to create an JPanel.
I need to show the alert box using JSObject. How can I get the window reference in the helper class. I tried the following in the helper class but got error.
Thanks
pavan in
Ranch Hand

Joined: Oct 22, 2002
Posts: 64
Sorry.Here is the code
Linda Jones
Ranch Hand

Joined: Aug 17, 2002
Posts: 57
What does the error say?
By the way you have an error in the code sample. Check this is not in your actual code.

should have capital letter on first MyApplet like:
pavan in
Ranch Hand

Joined: Oct 22, 2002
Posts: 64
My code contains Capital M (MyApplet). sorry, I did not type the code properly.
The error message is -
netscape.javascript.JSException
JSObject.getWindow(UnKnown Source)
Linda Jones
Ranch Hand

Joined: Aug 17, 2002
Posts: 57
Do you have the following in the HTML for your applet?

You need that to use the JSObject class.
Linda
Khurram Zaman
Greenhorn

Joined: Sep 24, 2002
Posts: 8
You wrote :
MyApplet a = new MyApplet();
JSObject.getWindow(applet);
Try this
MyApplet a = new MyApplet();
JSObject.getWindow(a);
I think you applet refernce was wrong.
Regards,


Khurram Mahmood<br />Software Engineer <br />Connect2web Pakistan Limited.
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 436
Your reference is incorrect. Follow Khurram's advice.

Maki Java in PK


Help gets you when you need it!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using JSObject in Applet