Default color of JTable row

background, java, jtable, swing, tablecellrenderer

Solution

Replacing `DefaultLookup.getColor(this, ui, "Table.dropCellForeground")` with `javax.swing.UIManager.getColor("Table.dropCellForeground")` should fix your problem.

Also you can modify (globally) the default values present in your Look & Feel just by using the `put(Object key, Object value)` method from UIManager

Problem

I have written one program where I am highlighting certain rows based on criteria.I posted one question regarding that :- JTable CustomRenderer Issue Solution given for this problem was that I need to set color in else for rows which do not come under criteria. So I decided that in else I will use default color of `JTable`. Modified code is ``` else{ c.setForeground(DefaultLookup.getColor(this, ui, "Table.dropCellForeground")); c.setBackground(DefaultLookup.getColor(this, ui, "Table.dropCellBackground")); } ``` So far so good, I am getting required behaviour, but when I am trying to make jar following warning is coming :- warning: DefaultLookup is internal proprietary API and may be removed in a future release So can any one suggest me if there is any other way to setting rows to default color in `JTable`.

Original source

Related problems