This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JTable: Set width of some grid lines

Ranch Hand
Posts: 574
VI Editor Chrome Linux
  • Mark post as helpful
  • send pies
  • 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.

Posts: 5167
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • 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.
keep an eye out for scorpions and black widows. But the tiny ads are safe.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic