Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTable - Wrapping text in a cell.

843804Jun 15 2005 — edited May 16 2008
Hello,

Can anyone tell me how to dynamically wrap the text in a particular cell of a JTable if it is to long to be displayed on one line? I don't care if it affects the row height, in fact I would like the row height to be automatically adjusted to fit the text.

Basically, I have a table with 3 columns, the third of which is a "notes" column and allows up to 500 characters to be displayed. When the text is too long the table truncates it with an elipsis (...) and the user can't see the rest. I would like the text to wrap within the cell (changing the row height) so that the user can read the entire note more easily. In addition, and I realize this may add a significant wrinkle, my client does not want to see a scrollbar just the whole note.

Has anybody been able to do this?

Thank you,

G Poole
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2008
Added on Jun 15 2005
13 comments
9,386 views