class ImageFilter extends FileFilter {

    /**
     * Array with all kinds of image extensions.
     */
    public static final String[] IMAGES = new String[8];

    static {
        IMAGES[0] = ".jpg";
        IMAGES[1] = ".jpeg";
        IMAGES[2] = ".png";
        IMAGES[3] = ".gif";
        IMAGES[4] = ".bmp";
        IMAGES[5] = ".wmf";
        IMAGES[6] = ".tif";
        IMAGES[7] = ".tiff";
    }

    /**
     * array that enables you to filter on image types.
     */
    public boolean[] filter = new boolean[8];

    /**
     * Constructs an ImageFilter allowing all images.
     */
    public ImageFilter() {
        for (int i = 0; i < filter.length; i++) {
            filter[i] = true;
        }
    }

    /**
     * Constructs an ImageFilter allowing some images.
     *
     * @param jpeg indicates if jpegs are allowed
     * @param png  indicates if pngs are allowed
     * @param gif  indicates if gifs are allowed
     * @param bmp  indicates if bmps are allowed
     * @param wmf  indicates if wmfs are allowed
     * @param tiff indicates if tiffs are allowed
     */
    public ImageFilter(boolean jpeg, boolean png, boolean gif, boolean bmp, boolean wmf, boolean tiff) {
        if (jpeg) {
            filter[0] = true;
            filter[1] = true;
        }
        if (png) {
            filter[2] = true;
        }
        if (gif) {
            filter[3] = true;
        }
        if (bmp) {
            filter[4] = true;
        }
        if (wmf) {
            filter[5] = true;
        }
        if (tiff) {
            filter[6] = true;
            filter[7] = true;
        }
    }

    /**
     * @param f File
     * @return boolean
     * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
     */
    public boolean accept(File f) {<FILL_FUNCTION_BODY>}

    /**
     * @return String
     * @see javax.swing.filechooser.FileFilter#getDescription()
     */
    public String getDescription() {
        return "Image files";
    }
}

        if (f.isDirectory()) {
            return true;
        }
        for (int i = 0; i < IMAGES.length; i++) {
            if (filter[i] && f.getName().toLowerCase().endsWith(IMAGES[i])) {
                return true;
            }
        }
        return false;
    
<methods>public abstract boolean accept(java.io.File) ,public abstract java.lang.String getDescription() <variables>