Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help needed

Status
Not open for further replies.

badbhoy

Programmer
Apr 11, 2002
12
GB
i need to get the value from a method in one class and set it in a textfield in a GUI class how can i do this!!
any help would be great
thanx
 
it very much depends what the relationship between the two classes is. are they named-nested, are they in the same package, or one is derived from the other?

the most hmmm how to say the most obvious, but probably not so elegant way would be if class A, that has the Method has a referneces of type class B (probably pass the actual reference in a constructor)

assuming class B has some textField
and that the output of your method is a String:

In class B and define a
public void displayResult(String result){
textFileObject.setText(result);
}

and in class A u can have
referenceToObjectOfClassB.displayResult(methodThatDoesSomething());

ok, i hope i dont jsut confuse u. again it very much depends what the relationship between the two classes are.
u should clarify that so that someone from the pro's here can help u out better. good luck!
Avendeval


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top