JTextArea word wrap resizing

Viewed 9793

So, I have JTextArea on a JPanel (BoxLayout). I also have Box filler that fills the rest of the JPanel. I need my JTextArea to start of with single-line-height (I can manage that), and to expand and reduce when that is needed.

Word wrap is enabled, I just need it to adjust it's height when new line is added/removed.

I tried with documentListener and getLineCount(), but it doesn't recognize wordwrap-newlines.

I'd like to avoid messing with the fonts if it's possible.

And, NO SCROLL PANES. It's essential that JTextArea is displayed fully at all times.

1 Answers
Related