开发者

Merging column headers alone in JTable

Is there a way to merge column headers on click of a button but the values in the cell should get appeneded with each other?

For instance:

10      15      20     25     30
A       B       C      D      E
B       C       D      A      E

10              20            30
AB              CD            E
BC              DA            E

A开发者_如何学Pythonctually the value A represents 10-15 B represents 15-20 and so on.Is this possible in JTable? Please don't confuse my earlier question with this.Here we try to merge two column headers not cells at the same time we append the values of the cell.


You can do whatever you want using the getValueAt(...) and setValueAt(...) methods.

So you get the values of the two columns and combine them into a single string and then reset the value in the first column. Then you set the second column to the empty string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜