Rendicahya
Rendicahya

Reputation: 4275

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.

Upvotes: 3

Views: 1497

Answers (2)

Peter
Peter

Reputation: 5798

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

Upvotes: 3

Jigar Joshi
Jigar Joshi

Reputation: 240890

Try HTML like this

<html>lineOne <br/> lineTwo </html>

Upvotes: 4

Related Questions