Java JTable行的默认颜色

Java JTable行的默认颜色,java,swing,background,jtable,tablecellrenderer,Java,Swing,Background,Jtable,Tablecellrenderer,我写了一个程序,根据标准突出显示某些行。我发布了一个问题: 针对这个问题给出的解决方案是,我需要为不符合条件的行在else中设置颜色。所以我决定在else中使用默认颜色JTable。修改后的代码是 else{ c.setForeground(DefaultLookup.getColor(this, ui, "Table.dropCellForeground")); c.setBackground(DefaultLookup.getColor(this

我写了一个程序,根据标准突出显示某些行。我发布了一个问题:

针对这个问题给出的解决方案是,我需要为不符合条件的行在else中设置颜色。所以我决定在else中使用默认颜色
JTable
。修改后的代码是

else{
           c.setForeground(DefaultLookup.getColor(this, ui, "Table.dropCellForeground")); 
           c.setBackground(DefaultLookup.getColor(this, ui, "Table.dropCellBackground"));
        } 
到目前为止还不错,我得到了要求的行为,但当我尝试制作jar时,以下警告即将到来:-

警告:DefaultLookup是内部专有API,可能会被删除 在未来的版本中


那么,有没有人可以建议我,是否有其他方法可以在
JTable

中将
DefaultLookup.getColor(这个ui,“Table.dropCellForeground”)
替换为
javax.swing.UIManager.getColor(“Table.dropCellForeground”)
应该可以解决您的问题


此外,您还可以通过使用

中的
put(Object key,Object value)
方法(全局)修改外观中的默认值,以便更快地发布一个演示了的上午问题,简短、可运行、可编译,不知道此描述有何错误请参阅此答案以了解如何获取颜色键。有关颜色键列表,请参见此URL。