Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable: Set width of some grid lines  RSS feed

 
Jim Venolia
Ranch Hand
Posts: 312
2
Chrome Linux VI Editor
  • 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.

 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!