简体   繁体   中英

How to use RowFilter.dateFilter on JTable if it contains Strings

I want to use a RowFilter.dateFilter on a JTable, but my Table has only Strings formatted like this "yyyy-MM-dd". If it's not possible to filter my JTable through a dateFilter, how can I solve this problem?

thanks

You should be storing Date objects in your TableModel, not a String representation of the date. Then you can use a renderer to format the date however you want it displayed. See Table Format Renderers for an example renderer.

Now you can use the DateFilter the way it was designed to be used.

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