Class SystemFileChooser.PatternFilter

java.lang.Object
com.formdev.flatlaf.util.SystemFileChooser.FileFilter
com.formdev.flatlaf.util.SystemFileChooser.PatternFilter
Enclosing class:
SystemFileChooser

public static final class SystemFileChooser.PatternFilter extends SystemFileChooser.FileFilter
A case-insensitive file filter which accepts file patterns containing the wildcard characters *? on Windows and Linux.
  • '*' matches any sequence of characters.
  • '?' matches any single character.
Sample filters: *.tar.gz or *_copy.txt

Warning: This filter is not supported on macOS. If used on macOS, the Swing file chooser JFileChooser is shown (instead of macOS file dialog) and a warning is logged. To avoid this, do not use this filter on macOS.

E.g.:

if( SystemInfo.isMacOS )
    chooser.addChoosableFileFilter( new FileNameExtensionFilter( "Compressed TAR", "tgz" ) );
else
    chooser.addChoosableFileFilter( new PatternFilter( "Compressed TAR", "*.tar.gz" ) );
 );
}
Since:
3.7.1
See Also: