Hello, I want to create a method to clear text box in my Client class.
I also need to use a method to clear text boxes in my Item class.
The question is : Can I call the method from the Item class? Also I see that the text boxes in the Item class are different in name and quantity than the Client class.
How can I do this? I have searched on Google and can't find anything useful... Thanks.
Maybe the answer is that I should make different method on any class that I need to use the Clear method. I want to use method calling because I need to do something like this because this is for a homework program I am doing...
Pascacio Toribio wrote:Can I call the method from the Item class
Giving you an answer would be very difficult since you havent shown us your code so far.
Here is my explanation of how stuff works in java in a nutshell.
Objects are defined by data and methods. In java, you need to have a reference to a class to call its method(Except static methods). So, in your code, does "Item" class have a reference of "Client" class ?
if yes, then does "Client" class have a field variable for its textbox ?
if yes, then does "Client" class have a getter for its textbox ?
if yes, then your code in item class can be simply as: