Link to code: Filter.java

package yourwork;

import ignorethis.Command;
import ignorethis.Pixmap;
import java.awt.Color;
import java.awt.Dimension;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

import javax.swing.JFileChooser;

/***************************************************************
 * Name:          
 * Course:        CompSci 6, Fall 2009
 * Collaborators:
 * Resources Used
 * Date Started:  
 * Purpose:
 *
 */ 

public class Filter extends Command
{
    // dialog for choosing file with filter data
    private static JFileChooser ourChooser = new JFileChooser(System
            .getProperties().getProperty("user.dir"));

    public Filter()
    {
        super("Filter");
    }

    /**
     * Displays file chooser for browsing in the project directory. and opens
     * the selected file
     * 
     * @return a new Scanner that produces values scanned from the selected
     *         file. null if file could not be opened or was not selected
     */
    public Scanner openFileFromDialog()
    {

        int retval = ourChooser.showOpenDialog(null);

        if (retval == JFileChooser.APPROVE_OPTION)
        {
            File f = ourChooser.getSelectedFile();
            Scanner s;
            try
            {
                s = new Scanner(f);
            } catch (FileNotFoundException e)
            {
                return null;
            }
            return s;
        }
        return null;
    }

    public void execute(Pixmap target)
    {
        Scanner in = openFileFromDialog();
        // get the size of the current pixmap
        Dimension bounds = target.getSize();
        // make a copy of the current pixmap
        Pixmap copy = new Pixmap(target);

        // TODO: complete Filter.execute
    }
}