Two or more lines in a JTable cell?
How do I put two or more lines into a single JTable cell? I tried to add '\n' at the end of the line but it doesn't work.
Try HTML like this
<html>lineOne <br/> lineTwo </html>
As extra info: the HTMl works because the default renderer for a JTable is a JLabel, the performance of the HTML in the JTable is not really good, so if you notice performance issues after using alot of HTMl then that is a good choice of makign better
look at http://ckw.phys.ncku.edu.tw/public/pub/src/HTML/Languages/Java/Swing/swingHTML/Chapter27.htm for a solution if you want high performance multiline labels
精彩评论