two horizontal JTable header and add separator to JTable

220 Views Asked by At

I'm working with JTable, and I want two things:

  1. I would like to add another table header to my JTable, is this possible? Both of them in horizontal.

  2. I want it's add a separator when the one of the attributes change its value, is this possible?

How can I do these things? See here the table as I want it.

screenshot

1

There are 1 best solutions below

1
On

Yes, you can add a second header. You can also add a separator by using the setBorder() method.

table.add(new JScrollPane(table));
table.setBorder(BorderFactory.createLineBorder(Color.RED,1));