File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JTable with multicolumn header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable with multicolumn header" Watch "JTable with multicolumn header" New topic

JTable with multicolumn header

Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
hi all,
I want to create a JTable with column headers that span over three columns. I tried to use the sample code of this site:
but that does not work well: the column header width is computed slightly to wide. Moreover, if I change the intercellspacing of the table, the difference between the column header width and the width of three actual columns gets "really", the header than span over say five or more columns.
I tried to change the algorithm that computes the width in different ways, but that actually changed nothing. I have the suspicion that the column width that is used as the base for the column header width computation is not the actual width that is displayed in the end.
has someone done anything similar? (I am using JDK 1.4 and greater)
I agree. Here's the link:
subject: JTable with multicolumn header
It's not a secret anymore!