简体   繁体   中英

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 use 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM