0

I'm working on a project, where I have a JTable, with different types of data, a JTextField, where you can set, your filter criteria, and a DropDown menu, to select the column.

When I'm filtering, I'm using this method...

RowFilter.regexFilter("(?i)" + filterField.getText(), columnToFilter);

to filter the rows.

However, on Date objects I have a little problem. In the table I display the Date in this format: 2017.04.15, but the filter uses the default toString() format of the Date (Fri May 05 05:47:46 CEST 2017).

My question is, if there is any way, I can force the regexFilter(), to use the date, in a different format?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dave
  • 49
  • 8
  • 1
    Is there a specific reason why you can't construct a date with the given input and use a `RowFilter.dateFilter()`? – BackSlash Apr 15 '17 at 10:54
  • With dateFilter(), you can only filter with, BEFORE, AFTER, EQUAL or NOT_EQUAL, but for example, if you would like to filter to 04, or 04.05 or any other date part, than you wouldn't be able to create a Date, from that information. – Dave Apr 15 '17 at 11:26
  • You can filter date _ranges_ like [this](http://stackoverflow.com/a/17856131/230513). – trashgod Apr 15 '17 at 12:19

0 Answers0