I have a JTable where I want one column to have multiline text in it. I have a class called MultiLineCellRenderer, and then I have another renderer class I created, to shade rows and set Fonts. This is what I have done:
When I run my app, the column I want to be multiline is still just one line of text. I do have a return in my data telling it to start a new line, so that isn't the problem. How can I set the renderer for one column and then set the rest with another renderer? Thanks for any help!
Have you tried simply creating a table with one column and assigning that the MultiLineCellRenderer? That'll help simplify whether the problem is in the renderer itself or in the way you were assigning the renderer to the column.
JCP, JCD, WCD... and all around nice guy.
posted 17 years ago
I took out the line of code that was setting the default renderer and left the line of code setting the cell renderer for the column that needs to have multiline cells, and it is still not working. However, I tried setting the defaultTableRenderer to the MultiLineCellRenderer and then it worked?? Why doesn't it work when I set it to just one column? Am I setting it correctly? The problem doesn't seem to be in the renderer. Any ideas? Here's the renderer extending JTextArea:
Thanks again! [ August 19, 2003: Message edited by: Jennifer Sohl ] [ August 19, 2003: Message edited by: Jennifer Sohl ]