Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在学习如何向 JTable 添加过滤器,所以我在 sun 网站上找到了教程
http://docs.oracle.com/javase/tutorial/uiswing/examples/components/TableFilterDemoProject/src/components/TableFilterDemo.java
我将代码复制到netbeans,代码编译并成功运行,但是当我在filtertext中输入“jane”时,表数据只是消失而不是显示该行。
寻求帮助谢谢。
它区分大小写。输入“简”
祝你好运
更新
如果你想让它不区分大小写, (?i) 在正则表达式之前可以正常工作,所以改变这一行
rf = RowFilter.regexFilter(filterText.getText(), 0);
像这样。
rf = RowFilter.regexFilter("(?i)"+ filterText.getText(), 0);
祝你好运!