Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't see class method via instance of class

 
Michael Cleary
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!

Thanks,
Mike
 
Michael Cleary
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
gui.setTotalField(total);
the controller class compiles just fine. Perhaps a weird bug in the IDE?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic