• Post Reply Bookmark Topic Watch Topic
  • New Topic

Print string array of dates in JTextArea...  RSS feed

 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I was having some fun with this bit of code, it's sort of meaningless, just testing things out. It should print a string array of five dates in a JTextArea, but it will only print the last one.
Why is that?
How do I get it to print the whole array of dates?

TIA :-)
 
Carlos Failde
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is this line:
scribbleField.setText(displayText);
- setText() overwrites whatever is already there.
To append a string to the existing text try:
scribbleField.setText(scribbleField.getText() + displayText);
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Carlos, that worked well :-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!