File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using JSObject in Applet

 
pavan in
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.Here is the code
 
Linda Jones
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have the following in the HTML for your applet?

You need that to use the JSObject class.
Linda
 
Khurram Zaman
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
Maki Jav
Ranch Hand
Posts: 445
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your reference is incorrect. Follow Khurram's advice.

Maki Java in PK
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic