• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting and setting the values of textfields from two different classes  RSS feed

 
Krad Despair
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Evening Guys, can anybody help me out?

I wanted to get the values of text fields from Class A and set the text fields in Class B but I cannot seem to do it.

This is the button action performed of my Class A




while this is the constructors on my Class B



Whenever I try to use System.out.print method to display the arguments passed from Class A to Class B it works, but I can't set those values in the textfields in Class B.

Please help
 
Piet Souris
Rancher
Posts: 1782
54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First a remark: use meaningfull names for your variables! t1, ..., t7 and a1,...a7 do not make your code very readable.

I gather from your code that the variables a1, ..., a7 are textfields in class B, and that the variable 'object' in class A
is of type B (see line 17 in class A, for instance).

Well, you say that you check all the arguments sent to the get() methods in class B and that these are fine.
You certainly set the values in the (assumed) textfields a1 .. .a7, so that should be fine too,

What does "new result().setVisible(true);' (line 02 in class B) exactly do? What is the return value of this method?
Might it be possible that you are showing this result().setVisible in stead of object 'object'?

Final remark: in line 15 of class A you are doing integer division for the variable 'ave'.So you get truncated averages.

Greetz,
Piet
 
Krad Despair
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day sir, thanks for your response. I've been waiting for this.

t1, ..., t7 and a1,...a7 are text fields. I already fixed the names of the variables. I am sorry for this.

You certainly set the values in the (assumed) textfields a1 .. .a7, so that should be fine too,


Actually, that is my problem.

Whenever I try to print out the arguments passed in the constructor, (e.g. String t1, String t2) via System.out.println it works well.
But whenever I try to set the text on the textbox. Nothing appears.



about the
new result().setVisible(true);

Don't mind it sir, it's a mistake on my part. I already removed it >_<

Thanks sir!

About the truncation, thanks for reminding me!

Godbless!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!