Probably this caused by backslash in your string. You can solve as follows (double backslash):
try {
String msg = dis.readUTF();
String oldText = txt_recMsg.getText();
StringBuilder yourStringBuilder = new StringBuilder();
yourStringBuilder.append(oldText);
yourStringBuilder.append("\\n");
yourStringBuilder.append(msg);
txt_recMsg.setText(yourStringBuilder.toString());
} catch (IOException ex) {
Logger.getLogger(ClientForm.class.getName()).log(Level.SEVERE, null, ex);
}
I've updated the code with adding StringBuilder. It has better performance and you can invoke append to StringBuilder. After your textField could be updated with setText method.
You can read more String vs. StringBuilder performace from
here[
^]!
Let me know if it works or not!