jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes JTable row selection 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 row selection" Watch "JTable row selection" New topic

JTable row selection

Derrick Albers

Joined: Nov 01, 2010
Posts: 20
I have a JTable that by default highlights the selected row when clicked, this works for my but I wanted to change the color of the font for a column. I created a TableCellRenderer for this and it works, the problem is that now when you select the row everything is highlight except for the cell that has a custome Renderer. How can I listen and change that cell with the row?

The is the render class:
Darryl Burke

Joined: May 03, 2008
Posts: 5090

To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.

edit Also note that for such trivial customization, you might as well extend DefaultTableCellRenderer.

luck, db
There are no new questions, but there may be new answers.
Derrick Albers

Joined: Nov 01, 2010
Posts: 20
I was able to fix by wrapping the value for that cell in <html> and set the font color and <u> to underline it without needing to change the Renderer.
I agree. Here's the link: http://aspose.com/file-tools
subject: JTable row selection
It's not a secret anymore!