I need some advice on trying to figure out why when I use the list or listFiles method it doesn't return a list of subdirectories that are in the parent directory. When I run the program I choose a file and after passing the file(current directory) to a string array it should iterate through and give me all of the subdirectories as well, but it isn't. I also tried just dealing in File class by using listFiles(), but no luck. Can anyone give me any pointers and why the list method isn't returning the sub directories as well.
public class jFileChooser {
public void browse(){
File f = null;
String[] paths;
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
if(chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
f = chooser.getCurrentDirectory();
paths = f.list();
for(String i:paths){
System.out.println(i);
}
}
}
public static void main(String[] args){
jFileChooser choser = new jFileChooser();
choser.browse();
}
}