Unable to append text to a textArea under JApplet
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Junaid_Mohammad
Posted On:   Sunday, July 21, 2002 08:15 AM

I have created a chat server, but i using a JApplet rather than a Applet to append my text to the textArea. I tried using the following chatTextArea.setText(getNextMessage()); But it deletes the last text that i enterended, i am unable to use the following java code in the JApplet chatTextArea.appendText(getNextMessage()); Becuase it gives the following error class javax.swing.JTextArea chatTextArea.appendText(getNextMessage()); What can i write to ensure that i can keep on appending text the to the text area without using the last text that i or the peron i am communicating with wrote. Thanks Junaid    More>>

I have created a chat server, but i using a JApplet rather than a Applet to append my text to the textArea.

I tried using the following

chatTextArea.setText(getNextMessage());


But it deletes the last text that i enterended, i am unable to use the following java code in the JApplet


chatTextArea.appendText(getNextMessage());

Becuase it gives the following error



class javax.swing.JTextArea

chatTextArea.appendText(getNextMessage());


What can i write to ensure that i can keep on appending text the to the text area without using the last text that i or the peron i am communicating with wrote.

Thanks

Junaid

   <<Less

Re: Unable to append text to a textArea under JApplet

Posted By:   Junaid_Mohammad  
Posted On:   Sunday, July 21, 2002 11:42 AM

I found the answer as follow:




String theText = chatTextArea.getText();

chatTextArea.setText(theText.concat(getNextMessage()+"
"));




Cheers

About | Sitemap | Contact