JXTable - 过滤表后的荧光笔
问题描述:
信息 - 为了更好的格式化,我在整个过程中使用了代码格式。JXTable - 过滤表后的荧光笔
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被有效过滤,这将仅适用于本身。
如果这是不可能的,因为一旦一排已经凸显,其他荧光笔可以不叫,你可以定义控制器其中:
一)具有propertyChangeListner表,侦听过滤状态
b)与行的集合和为propertyChange荧光笔
三)检查行,切换NEVER和您的自定义适当的荧光笔的谓词的特殊述。突出显示器的属性更改将触发重新绘制
强制重绘基本上是在test.org.jdesktop.swingx.renderer软件包中的HighlighterClientVisualCheck示例。