I want to use the “Home” button in JFileChooser
to toggle between a custom directory and the home directory.
static final String HOME = System.getProperty("user.home");
static final String CUSTOM = System.getProperty("user.home")+"/.jpilot";
javax.swing.JFileChooser fc = new javax.swing.JFileChooser(new File("TestData/in"));
if (fc.homeButtonAccessd())
if (fc.getCurrentDirectory().equals(HOME))
fc.setCurrentDirectory(CUSTOM);
else
fc.setCurrentDirectory(HOME);
fc.showOpenDialog(this);
File file = fc.getSelectedFile();
So my question is how to replace the fictional fc.homeButtonAccessd()
method with a working code.