This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Suppress the Cell color change on Focus Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Suppress the Cell color change on Focus" Watch "Suppress the Cell color change on Focus" New topic

Suppress the Cell color change on Focus

guilhem Haentjens

Joined: May 22, 2003
Posts: 1
I Want to use a DefaultTableModel and I succes
to set the color I wanted to on the selected rows.
The problem is that the cell on Focus keep White With "DefaultTableModel" and I don't want to.
For information :
Before usinng DefaultTableModel I try with an simple implementation of "AbstractTableModel" And I din't have this PB but "DefaultTableModel" may be more interresting for other things.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

DefaultTableModel shouldn't control the colors of the table... it just holds the data...

Maybe you are asking about DefaultTableCellRenderer?

If you want to keep the focus and color that DefaultTableCellRenderer and just add some more you can call super.getTableCellRendererComponent() with all the parameters that got passed into your getTableCellRendererComponent() method, cast the component you get back to a JLabel, mess with that JLabel and then return it.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: Suppress the Cell color change on Focus
It's not a secret anymore!