I have two ComboBoxes each of them filters a diferent row of my JTable, what I want to do is to mantain my filter on each user select,
Example:
At the moment
First ComboBox selects Option A and table is filtered displaying only Option A
Second ComboBox select Option B and table is filtered displaying only Option B
What I need is:
First ComboBox selects Option A and table is filtered displaying matched cases for Option A
Then
Second ComboBox select Option B and table must Display values for Matching case of the first ComboBox and the second ComboBox displaying Option 'A + B'
This is my ComboBox code that filters the table individualy:
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);
}
});
So is there a way to always match cases from both ComboBoxes when one option is selected?