-3

How can I perform a search in JTable?

My CSV file contains:

stdid 001
stdname monish
dob 03/5/1789

And similar records for the rest of the file. I am able to bind using CSV Parser and get data into JTable. I want to perform a search on it the table using input from a JTextField. How can I perform this?

mKorbel
  • 109,525
  • 20
  • 134
  • 319

1 Answers1

2

You can use a RowFilter/RowSorter. You can read more at Sorting and Filtering from the How to use Tables tutorial.

You can can also see a working example in the question posted here.

enter image description here

The accepted answer also provides a solution for case-insensitive filtering, if you're interested in that functionality

Community
  • 1
  • 1
Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720