我试图过滤响应textField中3个输入的组合的表的行,输入值是floats。问题是当我单击按钮以获得结果时,表为空并且不包含任何数据。这是我的代码:
public void actionPerformed(ActionEvent e) {
float pr = Float.parseFloat(PrbInput.getText());
float tr = Float.parseFloat(TrafficInput.getText());
float av = Float.parseFloat(AvgInput.getText());
sorter = new TableRowSorter<TableModel>(model);
table.setRowSorter(sorter);
RowFilter<TableModel, Integer> f1 = RowFilter.numberFilter(RowFilter.ComparisonType.AFTER, pr, 7);
RowFilter<TableModel, Integer> f2 = RowFilter.numberFilter(RowFilter.ComparisonType.AFTER, tr, 9);
RowFilter<TableModel, Integer> f3 = RowFilter.numberFilter(RowFilter.ComparisonType.AFTER, av, 21);
List<RowFilter<TableModel, Integer>> filters = Arrays.asList(f1, f2,f3);
final RowFilter<TableModel, Integer> filter = RowFilter.andFilter(filters);
sorter.setRowFilter(filter);
}