Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My application is firstly open class2 (my main page). When I was click the button in class2 = open class1 (but class2 open background). Then my question = click the button in class1 to sent some text to textfield in class2(this is second class2). And the sending text go there (records are mixed). I don't want to second one. How can I fix this. I am so sory my English maybe I have to put project competely. Thank you for helping..

This is my project link:(I could explain it better.)
Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.[^]

This is class1.java ;
Java
public void sent(class2 theOtherClassInstance) {
if (jCheckBox1.isSelected()) {
theOtherClassInstance.jTextField1.setText("sent this text"); // "jtextfield1" in class2
}
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
class2 theOtherClassInstance = new class2();
theOtherClassInstance.setVisible(true);
sent(theOtherClassInstance);
this.setVisible(false);
}
Posted
Updated 9-Jan-16 10:35am
v5
Comments
Sergey Alexandrovich Kryukov 9-Jan-16 12:33pm    
The question makes no sense. There is no such concept as "open a class".
Such problem are easily solved using the debugger. Most useful debugger tool is the "call stack".
—SA
bugsoul 9-Jan-16 17:22pm    
Hi Sergey, could you please look at my project(I put link my question). I explaned exactly what I wanted in project.
bugsoul 9-Jan-16 13:31pm    
Sorry, I know my question is insufficient.
My application is firstly open class2 (my main page). When I was click the button in class2 = open class1 (but class2 open background). Then my question = click the button in class1 to sent some text to textfield in class2. But opens another class2 more. And the sending text go there (records are mixed). I am so sory my English maybe I have to put project competely.
Maciej Los 9-Jan-16 16:49pm    
Use "Reply" widget if you want to notify an interlocutor about your comment.
bugsoul 9-Jan-16 17:13pm    
Thanks. Could you please give an example for my code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900