I am trying to use JFileChooserto get files to load and save. The dialog with openFileDialog()works fine, but when I use the method saveFileDialog(), the dialog box contains all the file names that are grayed out. This happens with or without FileFilter(my example includes one to better show what I see).
Here is a minimal program to illustrate:
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.filechooser.FileNameExtensionFilter;
public class Temp extends JFrame {
public static void main(String[] args){
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JFileChooser chooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("Text File", "txt");
chooser.setFileFilter(filter);
frame.setVisible(true);
chooser.showOpenDialog(null);
chooser.showSaveDialog(null);
}
}
Here is what I see in the Open dialog box:
Open the dialog

Here is what I see in the Save dialog :
Save dialog

Although you are inactive, all files in the save dialog can be selected.
I am on Mac / Mountain Lion and Java 7, if that matters.
? ?
(: MadProgrammer + trashgod , , , () Mac)