Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Removing Horizontal Lines in a JTable Column

843806Feb 18 2009 — edited Feb 18 2009
Hi,

I want to remove the horizontal gridlines in a single column of my JTable. That column has a custom renderer that extends DefaultTableCellRenderer, and I've overridden the getTableCellRendererComponent method as follows:
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {

		comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
		comp.setBackground(Color.BLACK);
		comp.setForeground(Color.WHITE);
		
		return comp;
	}
However, I also want no gridlines to be displayed in this column (i.e. I want none of the lines between the cells in this column to appear). Is there any way to do this?

Thanks,
hhung
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2009
Added on Feb 18 2009
1 comment
190 views