• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding columns inside another column in JTable

 
Pooja Patole
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic