• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable Cell with Multi line  RSS feed

 
Mahesh x Bogadi
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem.
I have a table. in which I am going added Cell element which are multi line.
i.e say I add string "<html>mahesh<br>bogadi" to a cell. I wish to get it in multi line. Though the string appears in 2 lines the cell height does not increase so that I can see both the lines.

please suggest me to make the table cell size(width) dynmically adjustable to the number of lines in the string.

Also please suggest me how to make the table cells non-editable.

thanks
 
Johan Sun
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please refer to sun's online java tutorial and JTable API. u need to write your own table cell renderer, in which you set the table cell's height for each cell according to it's content; also, u can overload JTable's "isCellEditable(row, col)" method to make it ineditable.
 
Mahesh x Bogadi
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!