合并 JTable 中的单元格
Is it possible to merge some cells of a JTable object?
(source: codeguru.com)
If it's not possible through JTable what is the best approach. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 TableModel 合并原始 TableModel 的两列来实现 JTable。
You could implement a JTable using a TableModel merging two columns of the original TableModel.
不是开箱即用的。 这里是一个支持合并任意单元格的示例。 此页面有几个带有跨单元格的表格示例。 当然,它已经很旧了,而且一分钱一分货。 如果可以选择付费软件,JIDE Grids 有一些非常好的 Swing 表支持包括自定义单元格跨度。
Not out-of-the-box. Here is an example that supports merging arbitrarty cells. This page has several examples of tables with spanning cells. Of course it's old and you get what you pay for. If paid software is an option, JIDE Grids has some really nice Swing table support including custom cell spans.