1 19 package org.lucane.applications.slideshow; 20 21 import java.io.File ; 22 23 import javax.swing.filechooser.FileFilter ; 24 25 public class ImageFileFilter extends FileFilter 26 implements java.io.FileFilter 27 { 28 private boolean acceptDirs; 29 private String description; 30 31 public ImageFileFilter(boolean acceptDirs, String description) 32 { 33 this.acceptDirs = acceptDirs; 34 this.description = description; 35 } 36 37 public boolean accept(File f) 38 { 39 if(f.isDirectory() && acceptDirs) 40 return true; 41 42 String n = f.getName().toLowerCase(); 43 return n.endsWith(".png") || n.endsWith(".gif") || n.endsWith(".jpg"); 44 } 45 46 public String getDescription() { 47 return description; 48 } 49 } | Popular Tags |