|
21 | 21 | import javafx.scene.text.Text; |
22 | 22 | import javafx.scene.text.TextAlignment; |
23 | 23 | import javafx.stage.FileChooser; |
| 24 | +import javafx.stage.FileChooser.ExtensionFilter; |
24 | 25 |
|
25 | 26 | import java.io.File; |
26 | 27 | import java.io.IOException; |
@@ -98,6 +99,18 @@ public interface Factory { |
98 | 99 | // Show a file picker so the user can open one or more images from disk |
99 | 100 | final FileChooser fileChooser = new FileChooser(); |
100 | 101 | fileChooser.setTitle("Open an image"); |
| 102 | + fileChooser.getExtensionFilters().addAll( |
| 103 | + new ExtensionFilter("Image Files", |
| 104 | + "*.bmp", "*.dib", // Windows bitmaps |
| 105 | + "*.jpeg", "*.jpg", "*.jpe", // JPEG files |
| 106 | + "*.jp2", // JPEG 2000 files |
| 107 | + "*.png", // Portable Network Graphics |
| 108 | + "*.webp", // WebP |
| 109 | + "*.pbm", "*.pgm", "*.ppm", // Portable image format |
| 110 | + "*.sr", "*.ras", // Sun rasters |
| 111 | + "*.tiff", "*.tif" // TIFF files |
| 112 | + ), |
| 113 | + new ExtensionFilter("All Files", "*.*")); |
101 | 114 |
|
102 | 115 | final List<File> imageFiles = fileChooser.showOpenMultipleDialog(this.getScene().getWindow()); |
103 | 116 |
|
|
0 commit comments