File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Applet introspection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet introspection" Watch "Applet introspection" New topic
Author

Applet introspection

Angus Rose
Ranch Hand

Joined: Jun 21, 2002
Posts: 56
Is it possible to load an applet into an application and use the reflection api in order to see what methods and attributes the applet conatins?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Yes.


[Jess in Action][AskingGoodQuestions]
Angus Rose
Ranch Hand

Joined: Jun 21, 2002
Posts: 56
Well thanks for the short and sweet reply. The next question is how?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

An applet is no different from any other object. You get the Class object for the applet class, then use the getDeclaredMethods() and getDeclaredFields() methods to investigate it.
Angus Rose
Ranch Hand

Joined: Jun 21, 2002
Posts: 56
Can it be done on an applet that is currently running in a browser?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Sure, by code in the applet itself, or by another applet on the same page if the target applet has the MAYSCRIPT="TRUE" attribute on the HTML page.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet introspection