Skip to content

Instantly share code, notes, and snippets.

@chriswhocodes
Created January 24, 2014 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriswhocodes/8599850 to your computer and use it in GitHub Desktop.
Save chriswhocodes/8599850 to your computer and use it in GitHub Desktop.
JavaFX FileChooser.ExtensionFilter *.* not working on OSX
import java.io.File;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
public class TestFileChooser extends Application
{
@Override
public void start(Stage stage) throws Exception
{
BorderPane borderPane = new BorderPane();
Scene scene = new Scene(borderPane, 400, 400);
stage.setScene(scene);
stage.show();
FileChooser fc = new FileChooser();
fc.setTitle("Choose log file");
fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("Log Files", "*.log"));
fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("All Files", "*.*"));
String searchDir = System.getProperty("user.dir");
File dirFile = new File(searchDir);
fc.setInitialDirectory(dirFile);
fc.showOpenDialog(stage);
}
public static void main(String[] args)
{
launch(args);
}
}
@chriswhocodes
Copy link
Author

Works in 1.8.0b124
Looks like the combo box to select the filter is missing in 1.7.0_51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment