Click here to Skip to main content
14,698,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Cannot find symbol method append in java netbeans
what could be the problem

try {
    String msg = dis.readUTF();
} catch (IOException ex) {
    Logger.getLogger(ClientForm.class.getName()).log(Level.SEVERE, null, ex);
Updated 13-Feb-20 6:11am

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();

} 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!
kami124 11-Jun-14 6:25am
Still same problem, problem some where in txt_recMsg
norbitrial 11-Jun-14 6:30am
Is txt_recMsg a textfield or textbox? Have you declared txt_recMsg before you wanted to invoke append method?
kami124 11-Jun-14 6:34am
its textfield. first i create txt_recMsg and then invoke append method
norbitrial 11-Jun-14 6:56am
I've improved my solution with StringBuilder for better performance and setText method in order to change the value of your textField.
kami124 11-Jun-14 7:15am
Perfect its working
joxb 20-Sep-19 14:20pm
Where should I put this text? I'm kind of new to coding so I don't really understand.
You have not declared the variable txt_recMsg in the above code. But assuming it is a string, then there is no append method, as the documentation[^] shows. You need to use the StringBuffer class[^].
kami124 11-Jun-14 6:36am
its declared its textfield

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