Nandini,
1. Extend JFileChooser and call setFileFilter(). All you have to do is extend the javax.swing.filechooser.Fi
Then override aproveSelection so that folders you can accept have contents of the right type.
2. Call listFiles on the File returned and iterate through the File array that is returned, call getPath() which returns a string with the full path of the file. Do an addElement to the Vector and thats that!
Regards,
Chrisos.
Main Topics
Browse All Topics





by: OviPosted on 2001-06-14 at 04:28:39ID: 6190442
1. In the JFileChooser class you can specify the mode (only directories, only files, both) and filters.
2. Once you have a Directory selected, the file choodser will return to you an java.io.File object. In this File object, if is a directory you can call the method listFiles(), which will return to you an array of File objects. The rest depends on you (what you will do with the files).