JavaFX FileChooser: how to set file filters?

You could do: FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(“TXT files (*.txt)”, “*.txt”); chooser.getExtensionFilters().add(extFilter); Here is a simple example: public class ExtensionFilterExample extends Application { public static void main(String[] args) { launch(args); } @Override public void start(final Stage primaryStage) { primaryStage.setTitle(“Extension Filter Example”); final Label fileLabel = new Label(); Button btn = new Button(“Open FileChooser”); btn.setOnAction(new EventHandler<ActionEvent>() … Read more

onShowFileChooser() from android webview works only once

firstly, sorry to my english. you should return empty Uri[]{} to file receive mUploadMessageForAndroid5.onReceiveValue(new Uri[]{}); my code can choose take photo or local image: private static final int REQUEST_GET_THE_THUMBNAIL = 4000; private static final long ANIMATION_DURATION = 200; public final static int FILECHOOSER_RESULTCODE = 1; public final static int FILECHOOSER_RESULTCODE_FOR_ANDROID_5 = 2; //JS webView.getSettings().setJavaScriptEnabled(true); //set … Read more

File/folder chooser dialog from a Windows batch script

File Browser Update 2016.3.20: Since PowerShell is a native component of all modern Windows installations nowadays, I’m declaring the C# fallback as no longer necessary. If you still need it for Vista or XP compatibility, I moved it to a new answer. Starting with this edit, I’m rewriting the script as a Batch + PowerShell … Read more

JavaFX FileChooser and DirectoryChooser

A FileChooser is available as part of the JavaFX API. Example usage from javadoc: FileChooser fileChooser = new FileChooser(); fileChooser.setTitle(“Open Resource File”); fileChooser.getExtensionFilters().addAll( new ExtensionFilter(“Text Files”, “*.txt”), new ExtensionFilter(“Image Files”, “*.png”, “*.jpg”, “*.gif”), new ExtensionFilter(“Audio Files”, “*.wav”, “*.mp3”, “*.aac”), new ExtensionFilter(“All Files”, “*.*”)); File selectedFile = fileChooser.showOpenDialog(mainStage); if (selectedFile != null) { mainStage.display(selectedFile); } A … Read more