File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About JTable

 
Meena J
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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!
 
Chris Shepherd
Ranch Hand
Posts: 286
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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 Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic