src/main/java/org/openjfx/App.java
private static void configureFileChooser(
            final FileChooser fileChooser
    ) {
        fileChooser.setTitle("Choose Pictures");

        String formats[] = Arrays.stream(ImageConvertingFormatEnum.values()).map(
                (item) -> item.formatValues
        )
                .collect(
                        Collector.of(
                                () -> new ArrayList<String>(),
                                (prev, currFormatValues) -> {

                                    Stream.of(currFormatValues).forEach(
                                            formatValue -> {
                                                prev.add("*." + formatValue.toUpperCase());
                                                prev.add("*." + formatValue.toLowerCase());
                                            }
                                    );

                                },
                                BinaryOperator.maxBy((a, b) -> 1),
                                (result) -> result.toArray(new String[0])
                        )
                );

        FileChooser.ExtensionFilter fileExtensions = new FileChooser.ExtensionFilter(
                "Images",
                formats
        );
        fileChooser.getExtensionFilters().add(fileExtensions);

    }
/**
     * Only allow pick jpg/png/gif image files
     *
     * @param fileChooser
     */
Only allow pick jpg/png/gif image files
@param fileChooser
Only allow pick jpg / png / gif image files @param fileChooser
private static void configureFileChooser(
            final FileChooser fileChooser
    ) {
        fileChooser.setTitle("Choose Pictures");
        String formats[] = Arrays.stream(ImageConvertingFormatEnum.values()).map(
                (item) -> item.formatValues
        )
                .collect(
                        Collector.of(
                                () -> new ArrayList<String>(),
                                (prev, currFormatValues) -> {
                                    Stream.of(currFormatValues).forEach(
                                            formatValue -> {
                                                prev.add("*." + formatValue.toUpperCase());
                                                prev.add("*." + formatValue.toLowerCase());
                                            }
                                    );
                                },
                                BinaryOperator.maxBy((a, b) -> 1),
                                (result) -> result.toArray(new String[0])
                        )
                );
        FileChooser.ExtensionFilter fileExtensions = new FileChooser.ExtensionFilter(
                "Images",
                formats
        );
        fileChooser.getExtensionFilters().add(fileExtensions);
    }
private static void configureFileChooser ( final FileChooser fileChooser ) { fileChooser . setTitle ( "Choose Pictures" ) ; String formats [ ] = Arrays . stream ( ImageConvertingFormatEnum . values ( ) ) . map ( ( item ) -> item . formatValues ) . collect ( Collector . of ( ( ) -> new ArrayList < String > ( ) , ( prev , currFormatValues ) -> { Stream . of ( currFormatValues ) . forEach ( formatValue -> { prev . add ( "*." + formatValue . toUpperCase ( ) ) ; prev . add ( "*." + formatValue . toLowerCase ( ) ) ; } ) ; } , BinaryOperator . maxBy ( ( a , b ) -> 1 ) , ( result ) -> result . toArray ( new String [ 0 ] ) ) ) ; FileChooser . ExtensionFilter fileExtensions = new FileChooser . ExtensionFilter ( "Images" , formats ) ; fileChooser . getExtensionFilters ( ) . add ( fileExtensions ) ; }
Only allow pick jpg/png/gif image files
 @param fileChooser
Only allow pick jpg / png / gif image files @param fileChooser