import javax.swing.JFileChooser;
import java.awt.Component;
import javax.swing.JDialog;
import javax.swing.JButton;

/**
 * JPaint File Chooser class opens up a file dialog where you can browse
 * for the file you are looking for. You can either choose to save or open the 
 * file aftewards.
 **/
public class JPaintFileChooser extends JFileChooser
{
	private JDialog fileChooserDialog;
	private ExampleFileFilter filter;
	
	/** 
	 * Creates a default JPaintFileChooser Constructor and sets the extensions
	 * for files that are only allowed to be opened and saved.  
	 **/
	public JPaintFileChooser(Component parent)
	{
		// creates a filter and adds the valid extensions on to it
		filter = new ExampleFileFilter ();
		filter.addExtension("jpg");
		filter.addExtension("gif");
		filter.addExtension("png");
		filter.addExtension("pdf");
		setFileFilter(filter);
		// instantiates the file chooser dialog
		fileChooserDialog = createDialog(parent);
	} 
	
	/** Returns the file chooser dialog. **/
	public JDialog getFileChooserDialog()
	{
		return fileChooserDialog;
	}
}