With java lambdas (available since java 8) you can simply convert javax.swing.filechooser.FileFilter
to java.io.FileFilter
in one line.
javax.swing.filechooser.FileFilter swingFilter = new FileNameExtensionFilter("jpeg files", "jpeg");
java.io.FileFilter ioFilter = file -> swingFilter.accept(file);
new File("myDirectory").listFiles(ioFilter);