开发者

Two or more lines in a JTable cell?

开发者_C百科

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜