Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable cell rendering with no borders

 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTable.setShowHorizontalLines(false) to only hide the horizontal lines.
JTable.setShowVerticalLines(false) to only hide the vertical lines.
JTable.setShowGrid(false) to hide both.
 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you.
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic