This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTable cell rendering with no borders Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable cell rendering with no borders" Watch "JTable cell rendering with no borders" New topic
Author

JTable cell rendering with no borders

jite eghagha
Ranch Hand

Joined: Oct 06, 2006
Posts: 128
Hi,

I would like to remove all borders around the cells of a JTable. What should i do within my cellrenderer.

Just as I can .setBackground(); i'm looking for someway to .setBorder()

thanks
amar vemanaboyina
Greenhorn

Joined: Jan 13, 2009
Posts: 4
One simple way of doing it is setting the gridColor of JTable as transparent.
For Color use
and
set a (that is aplha) to zero. For transparency you can use any values to red, green, blue

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20077
    
  30

JTable.setShowHorizontalLines(false) to only hide the horizontal lines.
JTable.setShowVerticalLines(false) to only hide the vertical lines.
JTable.setShowGrid(false) to hide both.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
jite eghagha
Ranch Hand

Joined: Oct 06, 2006
Posts: 128
thank you.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20077
    
  30

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable cell rendering with no borders
 
It's not a secret anymore!