updating displayed jtextfield value

hi,

i am trying to read and display the updated value of a text field in one frame form(form 1) into the text field of another Jframe form(form2) of the same package....the problem is that when i read the value by printing it in form 1 i get the updated value however this updated value is not displayed in the JtextField(form 2) which should copy the value from another JtextField(form 1)....makes sense?

String jButton1txt = ((JButton)evt.getSource()).getText();

if(jButton1txt =="update")

{

String str = jTextField1.getText();

System.out.println("i am strs value--> "+str );

form2 G1 =new form2();

G1.jTextField1.setText(String.valueOf(str));

String str1 = G1.jTextField1.getText();

System.out.println("i am str1s value--> "+str1 );

so str1 shows the updated value which means it is reading the updated value from form 1 ..however this fails to show in the jtextfield1 of frame 2.

[1131 byte] By [ElishaWa] at [2007-11-27 9:49:35]
# 1

1) Don't know why your questions keep mentioning "the same package". The package has nothing to do with your problem or question.

2) Learn standard Java naming conventions. Variable names are not uppercased. (ie. G1 should be g1, well actually it should be a more descriptive name, since g1 means nothing to anybody)

3) You don't use "==" to compare Objects. You use the equals(..) method.

> however this fails to show in the jtextfield1 of frame 2.

Well, maybe you declared jTextField1 twice. Once as a class variable and once as a local variable. The local varialbe is probably added to the GUI.

If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",

see http://homepage1.nifty.com/algafield/sscce.html,

that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

camickra at 2007-7-13 0:18:09 > top of Java-index,Desktop,Core GUI APIs...