在 JTable 中显示 HTML [英] Displaying HTML in a JTable
本文介绍了在 JTable 中显示 HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能给我提供一个如何在 JTable 的单元格中显示 HTML 的示例?我知道这可以用于其他 Swing 组件,但我似乎无法弄清楚 JTables.
Can someone provide me with an example of how to display HTML in a cell of a JTable? I know this can be done for other Swing components but I can't seem to figure it out for JTables.
推荐答案
你是否记得按照 ...</html>
?JTable
中的默认字符串渲染器使用 JLabel
,所以这应该可以工作.只需将字符串设置为单元格值即可.
Are you remembering to put <html>
around the HTML markup as per <html>...</html>
? The default string renderer in a JTable
uses JLabel
, so this should work. Just set the String as the cell value.
这篇关于在 JTable 中显示 HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文