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
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
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”);
}
myTextArea.Append(mess);//should not compile myTextArea.append(mess);//should work