Thursday, December 10, 2009

[Java] How can append text to a TextArea from another class

 










some one help me please. have two classes A and B. i defined a TextArea myTextArea in A and want to append text to it from B. the program compiles fine but it is not appendding to the text area. below i have parts of my code.

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");
}

[Non-text portions of this message have been removed]

__._,_.___
Visit http://aiaiai.com or http://jgame.org for more groups to join.
Java Official Group is created for the following topics: Java 2 Enterprise Edition - J2EE, Java 2 Standard Edition - J2SE, Java 2 Micro Edition - J2ME, XML, XSL, XSD, XPATH, Web Services, Jini, JXTA for all type of Java Geeks.
Whoever posts spam / ads / job related message will be BANNED IMMEDIATELY
.

__,_._,___

No comments:

Post a Comment