• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Grouping and UnGrouping of JTable Rows

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As anyone done Grouping and UnGrouping of JTable Rows as we find in MS Excel?
Any pointers??
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Neelakantan Kuthalanathan:
Hi,

As anyone done Grouping and UnGrouping of JTable Rows as we find in MS Excel?
Any pointers??



Check out:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#sorting

Similar values will be grouped together after you sort.
 
Neelakantan Kuthalanathan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for teh reply..
But my requirement is different.
I need have a expandable nodes to expand/hide the grouped rows.
To understand my requirement,best example could be to See the Grouping feature in Ms-Excel.

thanks
neel
 
Maneesh Godbole
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My bad.
Missed out on what your saying completely.

Something like this?
http://java.sun.com/products/jfc/tsc/articles/treetable1/
 
Neelakantan Kuthalanathan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I need a feature like this.....But I am not sure how to change the FileSystemModel in the example to my requirement.

My requirent is like this as I have attached the Screen Shot:


As shown the screenshot i want the Group 1 ,2,3 to be expandable and hideable i.e should behave like a Jtree node.....In rest of the column User can enter any input i.e for the columns A,B,C..

I Hope you understood my problem now.
 
Neelakantan Kuthalanathan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Sheriff
Posts: 21865
105
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the link Maneesh has provided. A tree table looks to exactly what you need.
 
Neelakantan Kuthalanathan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks.I tried with the example.
But I have two problems I am facing:

1. The grid lines does'nt extend till the tree node
2. the Horizontal scroll bar never gets added...I am adding the JtreeTable component into scrollpane and set
but still no effect.

I am attaching the screen shot for your reference.


Any idea to resolve the issue
 
Rob Spoor
Sheriff
Posts: 21865
105
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Neelakantan Kuthalanathan:
2. the Horizontal scroll bar never gets added...I am adding the JtreeTable component into scrollpane and set
but still no effect.


That's a default property of JTable. Fortunately you can change it, using JTable.setAutoResizeMode. You'll most likely want AUTO_RESIZE_OFF.
 
Neelakantan Kuthalanathan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.
any idea on how to have the grid lines extended for the Jtree nodes?
 
Rob Spoor
Sheriff
Posts: 21865
105
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to play around with the tree's cell renderer. Using a LineBorder could do the trick. table.getGridColor() will return the color of the grid lines so they will always be the same.
 
Danger, 10,000 volts, very electic .... tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!