向 JTable 列添加文本背景颜色
动机是我想看到表格单元格中的尾随空格。例如,如果单元格包含“Foo Bar”,我希望在“Bar”之后看到空格字符。有没有办法更改文本背景颜色,以便我可以轻松地在 JTable 单元格中看到所有字符?我希望在整个专栏中都这样做。
The motivation is that I want to see trailing spaces in table cells. For instance, if the cell contains "Foo Bar ", I would like to see the space character after "Bar". Is there a way to change the text background color so that I can see all the characters easily in a JTable cell? I'm looking to do this for a whole column.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试修改第 i 列的单元格 defaulttablecellrenderer 中的组件。
我认为 arg4 和 arg5 是表格的行和列,因此您也可以控制此处单元格的渲染器。
try modifying the component in the cell defaulttablecellrenderer for column i.
I think arg4 and arg5 are row and column of the table so you can control the renderer for the cells here too.