I'm developing a Java app using JavaFX for it's user interface.
When I use the FileChooser class to load a CSV file from the computer hard drive in Os X Mavericks the dialog shows me all the files and folders, even the hidden one creating a lot of noise and making really hard to find the desired file.
This screenshot illustrates what I'm talking about:
I think this could be more a OS X issue, but I don't understand how to fix, at least I don't understand how I can fix it with JavaFX FileChooser class.
Here's my code:
Stage stage = new Stage();
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open File");
fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("Comma-Separated Values (CSV)", "*.csv")
);
fileChooser.setInitialDirectory(
new File(System.getProperty("user.home"))
);
File selectedFile = fileChooser.showOpenDialog(stage);
Update
This is the Google Chrome modal to open files.
After looking at sources...
FileChooser
is implemented over native dialogs and completely non customizable.
So, no, you can't force dialog to show/hide hidden files.
Inside FileChooser
dialog there should be an context menu item to show/hide them,
but you can't control this option from application
For example, here is how it looks on Linux:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With