When I take the print of the for statement, it prints on the console 40 times but when i try to display that string on the textarea , it gives me the result just one time,Please why is this happening?Why textarea is creating this issue?
Share
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.
You are probably calling
setText(String t)method in your for loop and therefore textArea’s text is cleaned and filled with the new string element each time your loop executes. So eventually, you see the last string of the loop is printed in your textArea. You can use the following to append the new string to the previous text hold in your textArea component: