• 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: Set width of some grid lines

 
Ranch Hand
Posts: 574
VI Editor Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using a JTable to display some data. I've got 3 categories of column data, and 2 categories of row data. What I would like to do is make the grid line between columns 4 and 5, and columns 9 and 10, be twice has wide as the other grid lines. Same for the grid line between rows 3 and 4.

It would be acceptable to just change the color of the grid line.

Any ideas on how to do this? I've thought of implementing unused cells and setting their width to something small, but then I need to write a shim to transfer my data to my table that would skip the dummy rows/columns. Besides, that seems kind of hacky.

edit: I'm not married to JTable, outside of this grid line issue it most closely matches what I want to display in the way I want to display it.

 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One way is to use multiple tables arranged side by side in a Container with an appropriate layout, with a MatteBorder on all except the last to give the thick line on its right. You will also have to add the table headers to a Container and set that as the containing scroll pane's header view.

You will probably want to setReorderingAllowed(false) on both table headers.

edit you'll have to share the selectionModels of all the tables, of course.
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic