i have two classes. a TextArea in in one of them and i want to append text to it from another class. can somebody give me a code example that can so this
Printable View
i have two classes. a TextArea in in one of them and i want to append text to it from another class. can somebody give me a code example that can so this
I have tried something like this but it is not showing anything in the textArea. i have two classes A and B
Class A
Class A extends javax.swing.JFrame{
private JtextArea myTextArea;
A( ){
myTextArea = new JtextArea;
}
public void setArea(String mess){
myTextArea.Append(mess);
}
}
Class B
Class B{
A newA;
B( ){
newA = new A;
}
//i have this line which is supposed to append text in myTextArea in class A
newA.setArea(“message”);
}
Code :myTextArea.Append(mess);//should not compile myTextArea.append(mess);//should work