开发者

Use JTable rowFilter for highliting rows

I am currenlty using the JTable rowFilter for filtering my rows. The filter hide lines which does not follow the configured pattern. I wish to know if it's possible to 开发者_如何学Gouse the rowFilter for changing the color or other of the result ? By example the line which follows the configured pattern are colored in red and other in white.

Thank you Sylvain


Nothing complicated. For String Instance, I would suggest to start with prepareRenderer. There you can set lots of parameters, as shown in RowFilter example here based on camickr's Table Row Rendering :-) Don't forget to set int modelRow = convertRowIndexToModel(row);

and my question about similair issue


For those approaches I would recommend using SwingX Libraries. Their JXTable can by default work with highlighter- and filterpipelines. The highlighter can also highlight by a given pattern.

Here an example from R.J. Lorimer


In order to change the appearance of a row you'd need to provide your own cell renderer which then could apply the same checks as your row filter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜