Two Laptop Bag
The moose likes Java in General and the fly likes Can't see class method via instance of class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Can Watch "Can New topic

Can't see class method via instance of class

Michael Cleary
Ranch Hand

Joined: Jul 29, 2003
Posts: 93
I am concerned w/ two classes here. One is a class which creates a GUI with various buttons, a JTextField and a JTextArea. The other class is a "controller" class whose constructor creates an instance of the GUI class (named "gui" of all things...). The controller class is supposed to handle events generated when one of the buttons on the GUI is clicked.

The GUI class constructor sets up all the gui components. Also in the GUI class I have two methods: one is a "getter" which returns a String array which is a list of button names. The other is a "setter" which sets the text in the JTextField.

Within the event handling method of the controller class I can invoke the "getter" method via "gui.getButtonNameList". However, if I try to invoke the "setter" method (named setTotalField), I cannot even see this method from the controller class. Both methods are public of course; the getter returns a String[], and the setter is void.

I don't understand why I cannot see the "setter" method from the controller class....??

Any assistance would be greatly appreciated!


Mike<br />SCJP 1.4<br />----------------------------<br /><br />----------------------------<br />There are 10 types of people<br />in the world. Those that <br />understand binary, and those<br />that don't.
Michael Cleary
Ranch Hand

Joined: Jul 29, 2003
Posts: 93
Had to add this to my previous post. When I said I couldn't "see" the setter method, I meant that in the IDE I'm using (JCreator Pro), it presents a drop-down list of available methods when you invoke an instance of a class. I do not see my "setter" in this list, but I do see the "getter". However, if I go ahead and add the line:
the controller class compiles just fine. Perhaps a weird bug in the IDE?
I agree. Here's the link:
subject: Can't see class method via instance of class
jQuery in Action, 3rd edition