• Post Reply Bookmark Topic Watch Topic
  • New Topic

Line wrap JTable cell?  RSS feed

 
Jeff Black
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm displying a few rows from a database to a Frame, but need the columns to maintain their "formatting" directly below the previous column.
JTable works, except I would like it to line wrap on the one field that could be two or three lines long. This display is read-only, non-editable.
Any other better solutions?
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look here: JTable Examples
or, have you considered using a custom renderer setting the value using HTML (with line breaks) in this particualr column?
 
Jeff Black
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, thank you. I went with a custom TableCellRenderer that extended JTextArea. Works great.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!