aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Skipping lines in JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Skipping lines in JTextArea" Watch "Skipping lines in JTextArea" New topic
Author

Skipping lines in JTextArea

Adam Blais
Greenhorn

Joined: Dec 02, 2004
Posts: 27
I'm adding multiple entries to a JTextArea using a for loop. I'm using the append() method to add, but everything ends up on the same line. How would I go about skipping to the next line after each entry?
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
Append a "\n" after each entry in the for loop. If you would like to skip a line (double spaced), append "\n\n".
Adam Blais
Greenhorn

Joined: Dec 02, 2004
Posts: 27
Thanks!
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
No Problem, glad I could help!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Skipping lines in JTextArea