I have a text area with some text in it and I want to add some lines to it again, (the first lines + the other lines that I want to add) but it doesn’t work.
The way I’m doing it right now erases the old text and shows just the new lines.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Instead of using
JTextArea.setText(String text), useJTextArea.append(String text).This will add text on to the end of your
JTextArea.Another option would be to use
getText()to get the text from theJTextArea, then manipulate the String (add or remove or change the String), then usesetText(String text)to set the text of theJTextAreato be the new String.