What string format for a directory does the JFileChooser expect?
Rather than have to navigate up umpteen levels from the default starting folder ("My Documents", where I never put anything) to find the file I want the JFileChooser to open, I want it to start in a given folder. My code is this:
Code:
JFileChooser fc;
if (e.getSource().equals(btnOpenDispatchFile)) {
if (sLastDirOpened.length() > 2) {
fc = new JFileChooser(sLastDirOpened);
} else {
//fc = new JFileChooser("//SorterSimulator/Data/"); <- First attempt; it runs, but still opens in "My Documents"
fc = new JFileChooser("\\SorterSimulator\Data\"); <- Second attempt - "invalid escape sequence"
fc = new JFileChooser("\\\SorterSimulator\\Data\\"); <- Third attempt - ""
fc = new JFileChooser();
}
After the first time, it works fine, but none of the "obvious" things I tried work to create it with a default folder to open. The full dir path is "C:\SorterSimulator\Data\"
What string do I need for it to open the folder I want?