How can I perform a case-insensitive filter on a JTable?

后端 未结 2 1179
野趣味
野趣味 2020-12-01 21:12

I am making a table with a text field below it where you can type in a word to filter the table. It works, but what I want to do is be able to filter it with the word typed

2条回答
  •  醉话见心
    2020-12-01 21:51

    Add the standard regex case-insensitivity flag:

    rowSorter.setRowFilter(RowFilter.regexFilter("(?i)" + text));
    

    I've tested this with your SSCCE (thanks for providing that) and it works.

提交回复
热议问题