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 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: 127
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: 19790
    
  20

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
How To Ask Questions How To Answer Questions
jite eghagha
Ranch Hand

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

Joined: Oct 27, 2005
Posts: 19790
    
  20

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