hello guys i am still new in java and i have been battling with this problem. i want to filter my data in my jtable.

i have got the following data in my jtable which is from my database.

| name | gender | courses |
|------|--------|---------|
| Ben  | male   | Science |
| Joe  |female  |   I.T   |
| Dan  | Male   | Science |

now i have got combo-boxes name,gender and courses

now i want to filter the table based on these assumptions

"i want all who are studying science"
so then the output becomes

| name |courses|     
|------|-------|      
| Ben  |Science|      
| Dan  |Science|  

"i want all males who are studying science"
so then the output becomes

| name | gender | courses |     
|------|--------|---------|      
| Ben  | male   | Science |      
| Dan  | Male   | Science | 

and so on..... Please any help or direction will be appreciated thanks

Edited 3 Years Ago by Benjamin_4

depend of how deep you want to go, you have to override RowFilter

___________________________________________________________

  • simple

  • extended

  • there is used JToggleButton for filtering, add Action/ItemListener to JComboBox then result will be the same from JComboBox

This article has been dead for over six months. Start a new discussion instead.