I want user to select files from existing files only and don't want to let him type the file name.
So how can we disable the file input field in JFileChooser?
Thank you.
I think what you really want is for the user to select an existing file.
You would write an action listener for the JFileChooser to check and make sure the file exists.
You still want the user to be able to type in the file input field so he can limit what's displayed in the JFileChooser,
For example, if the user types *.txt
, only .txt
files are displayed. If the user types one*
, only files that start with the letters o-n-e are displayed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With