wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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!
 
Don't get me started about those stupid light bulbs.
 
subject: Skipping lines in JTextArea
 
Similar Threads
JTextArea getting to the next line
wraping in JTable cell
Using JScrollPane
Hide a URL: Example (Download THIS File)
Display problem in JFrame