• 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

JTable Row Header

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh, just search this forum. here's a link:
http://www.esus.com/javaindex/j2se/jdk1.2/javaxswing/editableatomiccontrols/jtable/jtablerowheaders.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic