• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tricky JTextArea problem

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a JTextArea (or more than one) inside a JScrollPane

The JScrollPane, has VERTICAL_SCROLLING_AS_NEEDED, no horizontal scrolling.

When the frame is resized the scrollpane resizes accordingly.


My problem is:
Suppose I have 1000 words of text to put into the JTextArea.
If I squash the frame horizontally, the words wrap around which is fine,
and vertically, the scrollbar kicks in.
But I just want to display 3 lines of text, and always finish with three dots ...
when there is more text, but no room for it.

I used setPreferredSize on the JTextArea which makes sure I get three lines worth.
But when I select the text, the left over text is still hidden below the 3 lines.
I don't want to display this text, just use 3 dots...
Can anyone help?

Thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!