簡體   English   中英

JXTable-篩選表格后的熒光筆

[英]JXTable - Highlighter after filtering table

信息-為了獲得更好的格式設置,我在整個發布過程中都使用了代碼格式設置。

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上檢查行,在適當的時候在NEVER和您的自定義之間切換熒光筆的謂詞。 熒光筆的屬性更改將觸發重新繪制

強制重塗基本上是test.org.jdesktop.swingx.renderer包中的HighlighterClientVisualCheck示例的內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM