Search code examples
javamessagejtextarea

how do you display multiple message to a text area


I want to display multiple messages to the same text area without clearing any of previous messages.

double betAmount=100;
messages.setText("you are betting,$"+betAmount+"\n");
messages.setText("you stand\n");
messages.setText("you hit\n");

you are betting,$100.0 you stand you hit


Solution

  •  messages.setText("you are betting,$"+betAmount+"\n");
     messages.append("you stand\n");
     messages.append("you hit\n");