Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Border around cells in JTable

 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I set a border around a group of cells. Not just one cell but around say 4 cells.

// Mathias
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The short answer is yes. It's just a matter of configuring the cell renderers
you are using to have borders that draw parts of a larger "zone" border.
Here is some GUI code I wrote for a su doku app.
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much!!

I will try to get into your code.

// Mathias
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hummm .... another question about this subject.

I only want the border to be 1 pixel in width not 2.

// Mathias
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like this?
The new methods I used here are JTable's setShowGrid and setIntercellSpacing.
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot

I'm not very good at this but if you have time explaining the code then you are most welcome.

// Mathias
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you narrow down your question? which lines need explanation?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic