File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes invoke method with java reflection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "invoke method with java reflection" Watch "invoke method with java reflection" New topic

invoke method with java reflection

Geoffrey Laurens

Joined: Sep 19, 2006
Posts: 26

this is my class, i'm trying to setText in npm, nama by java reflection.
first i'm read all field thats available in this class, than if the field is type of JTextField than i'm try to invoke the setText method in that field with "geox" value. but it doesn't work why? can you all master java help me please.............

thanks for the reply
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
This is nearly a cross-post, as an almost identical post has been put in beginner forum. We don't like cross-posters.

Anyway. In what way "doesn't work"?

And another thing. This seems a very strange thing to be doing. Is it just a programming exercise? If not and it is for a real application, you should probably take a simpler, more direct approach.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Since, as Peter points out, this is a cross post, and its not really an advanced question I'm closing this topic. Please continue any dicussions in your other topic.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: invoke method with java reflection
It's not a secret anymore!