• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

About JTable

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am having a unique requirement in JTable. I am using JTable for the first time. So I dont know what things can be done with JTable.
My requirement is, I want to divide each cell/column in 2 cells...is it possible with JTable ? what should be done for doing so, if anybody has any idea, please let me know, i will be greatful to u.
Thanks in advance.
MMJ
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"MMJ" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it here.

You're going to need to make a custom renderer for your information by extending DefaultTableCellRenderer and set it on the table...

Thanks! and welcome to the JavaRanch!
 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you ever considered that it might actually be easier to simply combine the header cells from 2 columns into 1 cell. That way you could just leave the rest of your table alone and only the top row(your headers) would have to be special case.
That said, since I haven't used JTable directly(I'm using one that comes in a commercial package that makes this kind of stuff easier), I don't know how to suggest you do this. Maybe someone else can give you some pointers.
 
Meena J
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thanks Nathan !
I have changed my displayed name...is it according to the policies now ?
And Chris Thanks for the suggestions!!! combining header would be better option i think.
But could anyone tell me more about how to combine 2 or more header cells in JTable ??
Thanks in advance.
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Meena,
Have you seen these Web sites:
http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
http://www.codeguru.com/java
http://www.rgagnon.com/howto.html
I think you will find relevant code examples there.
Hope it helps.
Good Luck,
Avi.
 
Meena J
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Avi,
Thanks for those really useful links. I hope i will get my solution there.
Once again Thanks a lot!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for changing your name to a "legal" name...

And I hope that those links help you solve your problem...

Thanks!
 
If you're gonna buy things, buy this thing and I get a fat kickback:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic