• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Grouping and UnGrouping of JTable Rows

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Sheriff
Posts: 22803
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 22803
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks.
any idea on how to have the grid lines extended for the Jtree nodes?
 
Rob Spoor
Sheriff
Posts: 22803
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
pie. tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic