• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable Row Header

 
Sharmila Tankala
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Can i have the first column of the jtable as its rowheader
if so can i have an example
thanks in advance
sharmi
 
maggie woo
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess is you probably *CAN* by screwing around with it, but this is an interesting question since the JScrollPane accepts a row header (setRowHeader(JViewPort rowheader)), but JTable doesn't support one!
If no one has done it out there already, maybe the following track as a possiblity:
1) modify the column header for your "row header" column so that it is blank and unclickable--maybe a shade darker and "flat" instead of "beveled" which i think is the usual rendering.
2) add a cell renderer for the first column, something like a JButton or JToggleButton with a beveled border, make them uneditable.
3) if you want the user's click on the row header to do something (like "select the row"), then have a mouse listener or something--a JToggleButton might be a nice feature if you wanted to select the row (have it be "pressed" when the row is selected by a mouse click and "armed" when the row is selected in some other manner).
This is pretty advanced stuff I think. Try a google groups search to see if anyone's done it already out there...
And then, maybe post YOUR code up here! hurrah for that!
cheers,
- maggie
 
maggie woo
Ranch Hand
Posts: 35
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic