ps-aux
ps-aux

Reputation: 12174

JTextArea - get rid of extra line

When I use JTextArea I always get output:

xxxxxxxxxx
FirstLine
LastLine

xxxxxxxxxx

Where xxxxxx is the border of text area. Instead I would like it to be without extra line at the end. Like this:

xxxxxxxxx
FirstLine
LastLine
xxxxxxxxx

What should I do?

EDIT:I found a problem in my code when I was formatting code to post it here. It was rather unfortunate combination of factors which escaped my eyes. Please remove the question.

Upvotes: 1

Views: 141

Answers (2)

Aaron Digulla
Aaron Digulla

Reputation: 328790

There is a trailing \n in your document. Remove it to get rid of the empty last line.

Upvotes: 2

kajacx
kajacx

Reputation: 12949

Well, if you use println(), it always adds new line (\n) to the end of your string, you need to add these lines manually, e.g. print(line1 + "\n" + line2)

Upvotes: 2

Related Questions