Adding a search field to Jfilechooser
I created a JFileChooser and I need to add search functionality when a user browses a specific folder to find a specific file with ease, so the JFilechooser should have a text box where the user can type and filter other files in the given directory. How can I achieve this in java?
Here is my sample code that implements viewing the main files.
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());
}}
+3
source to share
No one has answered this question yet
See similar questions:
or similar: