JTable 单元格中有两行或多行?

发布于 2024-10-10 00:26:24 字数 52 浏览 0 评论 0原文

如何将两行或多行放入一个 JTable 单元格中?我尝试在行尾添加“\n”,但它不起作用。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心舞飞扬 2024-10-17 00:26:24

尝试这样的 HTML

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

Try HTML like this

<html>lineOne <br/> lineTwo </html>
墨离汐 2024-10-17 00:26:24

作为额外信息:HTMl 之所以有效,是因为 JTable 的默认渲染器是 JLabel,JTable 中 HTML 的性能并不是很好,因此,如果您在使用大量 HTMl 后发现性能问题,那么这是一个不错的选择。更好地

看看 http: //ckw.phys.ncku.edu.tw/public/pub/src/HTML/Languages/Java/Swing/swingHTML/Chapter27.htm 如果您想要高性能多行标签,请参阅解决方案

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文