File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes How to read a getter from javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "How to read a getter from javascript" Watch "How to read a getter from javascript" New topic

How to read a getter from javascript

Mike Gray
Ranch Hand

Joined: Feb 26, 2002
Posts: 31
I am using a third party applet that has 'getter' fileds that return booleans, stings or integers. How can I read these using Javascript ?
For example, there is a getter method in the applet that looks like this:
public boolean getIsFitToWidth()
return _imagePanel.getIsFitToWidth();
Which returns true or false.
Any info would be appreciated . . .

'Some people have a way with words. Other people . . . not have a way I guess.' - Steve Martin
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
hi Mike
I know that in IE, you can call applet's public methods using ID field on OBJECT tag and that would work for you I guess but in Netscape based browsers I guess that is a problem as EMBED tag doesn't work the way OBJECT tag works and the browser doesn't identify the component as an applet hence doesn't allow calling the same public method.
This is for the case when you are using Java Plugin. I'm not sure if things are behaving similar for simple APPLET tag as well.
I agree. Here's the link:
subject: How to read a getter from javascript
It's not a secret anymore!