wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes About JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "About JTable " Watch "About JTable " New topic
Author

About JTable

Meena J
Greenhorn

Joined: Feb 21, 2003
Posts: 8
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

Joined: Oct 18, 2000
Posts: 4121

"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!


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
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

Joined: Feb 21, 2003
Posts: 8
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

Joined: Oct 11, 2000
Posts: 1121

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

Joined: Feb 21, 2003
Posts: 8
Hi Avi,
Thanks for those really useful links. I hope i will get my solution there.
Once again Thanks a lot!
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Thanks for changing your name to a "legal" name...

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

Thanks!
 
 
subject: About JTable
 
Similar Threads
jtable
JTable
JTable
JTable
jtable