8

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.

Community
  • 1
  • 1
Addict
  • 803
  • 2
  • 9
  • 16
  • 1
    for better help sooner post an [SSCCE](http://sscce.org/), demonstrated a.m. issue, short, runnable, compilable, no idea whats wrong from this description – mKorbel Dec 07 '12 at 21:29

1 Answers1

15

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

Radu Ciopraga
  • 318
  • 2
  • 6
  • See this answer for how to get the color keys. http://stackoverflow.com/questions/730649/swing-uimanager-getcolor-keys – Nathan Jul 24 '13 at 23:15
  • 1
    See this URL for a list of color keys. http://alvinalexander.com/java/java-uimanager-color-keys-list – Nathan Jul 24 '13 at 23:15