Click here to Skip to main content
15,902,886 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my function to send code to another frame text area but only once i can send not continuosly.
C#
public void recmsg()
{
 try
 {
   String msg = dis.readUTF();
   String oldText = txt_recMsgClient.getText();
   StringBuilder yourStringBuilder = new StringBuilder();
   yourStringBuilder.append("\n").append(oldText).append(msg); 
   txt_recMsgClient.setText(yourStringBuilder.toString());
 }
 catch (IOException ex)
 {
   Logger.getLogger(ClientForm.class.getName()).log(Level.SEVERE, null, ex);
 }
}
Posted
Updated 11-Jun-14 22:27pm
v3

1 solution

Java
public void recmsg()
{
 try
 {
   String msg = dis.readUTF();
   String oldText = txt_recMsgClient.getText();
   StringBuilder yourStringBuilder = new StringBuilder();
   yourStringBuilder.append("\n").append(oldText).append(msg);
   txt_recMsgClient.setText(yourStringBuilder.toString());

   // Update txt_recMsgClient
   txt_recMsgClient.repaint();
 }
 catch (IOException ex)
 {
   Logger.getLogger(ClientForm.class.getName()).log(Level.SEVERE, null, ex);
 }
}
 
Share this answer
 

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