質問

情報-書式設定を改善するため、投稿全体でコードの書式設定を使用しました。

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?
役に立ちましたか?

解決

2番目の蛍光ペンを追加するだけですか?

jxTable.getHighlighters().addHighlighter()

JXtableが効果的にフィルタリングされた場合にのみ適用されるもの。

それが不可能な場合、行が強調表示されると、他の蛍光ペンは呼び出されない可能性があるため、コントローラーを定義することができます:

a)テーブルへのpropertyChangeListnerがあり、フィルターされた状態をリッスンしています

b)行のセットと蛍光ペンを持つ特別な述語を持っています

c)propertyChangeで行を確認し、必要に応じて蛍光ペンの述語をNEVERとカスタムの間で切り替えます。蛍光ペンのプロパティを変更すると、再描画がトリガーされます

再描画の強制は、基本的にtest.org.jdesktop.swingx.rendererパッケージのHighlighterClientVisualCheckサンプルの機能です。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top