• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't see class method via instance of class

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Our first order of business must be this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic