This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 19649
    
  18

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: 19649
    
  18

You're welcome.
 
 
subject: JTable cell rendering with no borders
 
Similar Threads
Creating a table without jTable
JTable selection problem
column margin in JTable
setBorder not working on JTable ?
JTable cell border