JTable每行具有不同的列数 [英] JTable with varying number of columns per row

查看:101
本文介绍了JTable每行具有不同的列数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我怎样才能得到一个JTable来仅用一列来布局某些行,如:


how can I get a JTable to layout some rows with just one column like:

A1 Section Title Row With long Text
A2          B2          C2          D2
A3          B3          C3          D3
A4          B4          C4          D4
A5 Section Title Row With long Text
A6          B6          C6          D6
A7 Section Title Row With long Text
A8          B8          C8          D8
A9          B9          C9          D9

代替

A1 Section Title Row With long Text  B1          C1          D1
A2                                   B2          C2          D2
A3                                   B3          C3          D3
A4                                   B4          C4          D4
A5 Section Title Row With long Text  B5          C5          D5
A6                                   B6          C6          D6
A7 Section Title Row With long Text  B7          C7          D7
A8                                   B8          C8          D8
A9                                   B9          C9          D9

我已经使用xhtmlrenderer完成了这种类型的布局,但是想知道是否可以更改JTable的单个单元格跨度. 谢谢.

I have done this type of layout using xhtmlrenderer but am wondering if it is possible to change the individual cell span of a JTable. Thanks.

推荐答案

看看该示例显示了如何在JTable中合并单元格".

Take a look at this example which shows how you can "merge cells" in a JTable.

这篇关于JTable每行具有不同的列数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆