This depends on what eaxctly you want to achieve.
I did something similar by creating my own JTableHeader, which was essentially just a JPanel
.
On it I placed "group" headers on the top row, over the columns I wanted to "group".
Then I cheated and used the existing tables row header and added it to the second row below the header.
This requires some slight of hand, as you need to know the columns you want to group/span and their widths. You also need to monitor for changes in their widths and update the header appropriately.
Most of the implementations I've seen use their own UI implementation, personally I don't like this as it undoes the work of the look and feel you're using.
You could have a look at this which demonstrates a number of interesting things you can do with JTable
s as well multi-column spanning, but again, it's using it's own UI to get it to work.
The implementation we've begin using at work works in the same way and the problem I have with it is that you can see the mouse resize cursor within the group header, which, to me, isn't really what you want the user to see