Created
January 24, 2014 15:46
-
-
Save chriswhocodes/8599850 to your computer and use it in GitHub Desktop.
JavaFX FileChooser.ExtensionFilter *.* not working on OSX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works in 1.8.0b124
Looks like the combo box to select the filter is missing in 1.7.0_51