I have created JFileChooser and I need to add search functionality when a user browse for a particular folder to locate a certain file with ease such the JFilechooser should have a text field where user can type and filter other files in a given directory. How can I achieve this in java?
Here is My sample code that implements basic file browsing.
JFileChooser chooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("Excell File Only", "csv");
chooser.setFileFilter(filter);
int returnVal = chooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
if (chooser.getSelectedFile() != null) {
path.setText(chooser.getSelectedFile().getName());
}}