I created JFileChooser and I want to restrict it only to the user.home directory and subfolders.
The selection mode of my JFileChooser is just directories.
So far I have used this:
final File directorylock = new File(System.getProperty("user.home"));
JFileChooser browse = new JFileChooser(directorylock);
browse.setFileView(new FileView() {
@Override
public Boolean isTraversable(File f) {
return directorylock.equals(f);
}
});
But every time I open JFileChooser, it shows me the user.home directory without subfolders and therefore I can’t access or select them.
How it should work: Open JFileChooser and show the user.home directory with all its subfolders. Be able to access and select subfolders. DO NOT have access to parent folders. directory user.home.
, - , !:)
, , : D