File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Adding columns inside another column in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Adding columns inside another column in JTable" Watch "Adding columns inside another column in JTable" New topic
Author

Adding columns inside another column in JTable

Pooja Patole
Ranch Hand

Joined: Mar 13, 2012
Posts: 35
Hello,

I have created my own TableModel and it is working fine. I have 4 columns already in it. I want to add 3 sub columns inside the column number 3 and 4. I went through an article in which i can insert a column in the table but couldn find any help in inserting sub columns. Can anyone please help me. The column name is "Heap Memory" and the three sub columns that i want to add in this column are "Used","Commited" and "Maximum".
Any help would be appreciated..

Thanks
Pooja
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
sounds like you want a multi width header (see the pic at the top of the link)

http://www.java2s.com/Code/Java/Swing-Components/MultiWidthHeaderExample.htm
Pooja Patole
Ranch Hand

Joined: Mar 13, 2012
Posts: 35
Hi Michael ,

I want something like this http://www.java2s.com/Code/Java/Swing-Components/GroupableGroupHeaderExample.htm but wanted to know if i really need to write so many classes for this?

Pooja
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> wanted to know if i really need to write so many classes for this?

doubtful it would work without them.

I recall something about rowSorters reacting funny to those classes,
so if you also wanted row sorting, those classes may require a major rewrite.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding columns inside another column in JTable