This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 4523

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:
subject: JTable row selection
Similar Threads
must click 2 times after clearSelection()
column margin in JTable
Problem with JTable
JTable: Howto: Row color depending on value
JTextPane as CellRenderer in JTable