// instantiate a background decorator
final ColorHighlighter hl = new ColorHighlighter(HighlightPredicate.NEVER, Color.YELLOW, null);
// register it with the table (of type JXTable)
table.addHighlighter(hl);
// set the predicate, f.i. highlight all cell that contain ADMIN
hl.setHighlightPredicate(new SearchPredicate("ADMIN"));
# 1 楼答案
在SwingX中(我忍不住炫耀:-),解决方案归结为安装一个荧光灯,并根据需要配置一个SearchPredicate:
# 2 楼答案
正如@kleopatra所建议的,使用一个自定义的
CellRenderer
(下面的示例只是一个POC,添加方法以更改搜索模式、突出显示颜色等):