信息 - 为了更好的格式化,我在整个帖子中使用了代码格式。

Hi,

I have a highlighted JXTable. Rows are highlighted, depending on the value 
of a specific column (c2). Everytime the value of column c2 changes, the color 
is switched from white to grey or from grey to white.

Example    
    c0  c1    c2   c3
    1 | aaa | ab | dd
    2 | aaa | ab | ee
    3 | aaa | cd | ff
    4 | aaa | cd | gg
    5 | bbb | ef | dd

Colors are like this:
1,2 -> white
3,4 -> grey
5   -> white

If I now filter for 'dd', my table looks like this

    c0  c1    c2   c3
    1 | aaa | ab | dd
    5 | bbb | ef | dd

And the colors are like this:
1 -> white
5 -> white

But I want the table to change the color of row 5, because the previous 
value in c2 was different.
See my Problem? How can I apply the highlighter again, on my JXTAble, 
after filtering? Or in other words, how can I highlight only the filtered 
values?
有帮助吗?

解决方案

你能添加第二个荧光笔吗?

jxTable.getHighlighters().addHighlighter()

只有在有效过滤JXtable时才会自我应用。

如果那是不可能的,因为一旦突出显示一行,可能不会调用其他荧光笔,你可以定义一个控制器

a)对表有一个propertyChangeListner,监听过滤状态

b)具有特殊谓词,包含行集和突出显示

c)在propertyChange上检查行,根据需要在“永久”和“自定义”之间切换突出显示器的谓词。荧光笔的属性更改将触发重绘

强制重绘基本上是test.org.jdesktop.swingx.renderer包中的HighlighterClientVisualCheck示例。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top