File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Border around cells in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Border around cells in JTable" Watch "Border around cells in JTable" New topic
Author

Border around cells in JTable

Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
Can I set a border around a group of cells. Not just one cell but around say 4 cells.

// Mathias


SCJP1.4
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
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.


There is no emoticon for what I am feeling!
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
Thank you very much!!

I will try to get into your code.

// Mathias
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
Hummm .... another question about this subject.

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

// Mathias
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Like this?
The new methods I used here are JTable's setShowGrid and setIntercellSpacing.
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
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

Joined: Sep 16, 2005
Posts: 1780
Can you narrow down your question? which lines need explanation?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Border around cells in JTable