我有兩個組合框他們每個人的篩選我的JTable的diferent行,我想要做的是十個分量上的每個用戶選擇我的過濾器,綁定兩個JComboBox的過濾器
例:
在此刻
首先組合框選擇選項A和過濾僅顯示選項表阿
第二組合框選擇選項B和表過濾僅顯示選項B
我需要的是:
首先組合框選擇選項A和過濾顯示用於選擇匹配的情況下表A中
然後
第二組合框選擇選項B和表必須顯示值第一個組合框和第二個組合框的匹配大小寫顯示選項'A + B'
這是我的組合框代碼,用於過濾單個表:
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
RowFilter<DefaultTableModel, Object> rf = RowFilter.regexFilter(comboBox.getSelectedItem().toString(), 2);
sorter.setRowFilter(rf);
}
});
comboBox_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
RowFilter<DefaultTableModel, Object> rf = RowFilter.regexFilter(comboBox_1.getSelectedItem().toString(), 3);
sorter.setRowFilter(rf);
}
});
那麼,有沒有一種方式,當選擇一個選項時總是匹配從兩個組合框的情況?
OMG,這是完美的正是我需要非常感謝你! –