ops... scusa mea culpa.... ho incollato troppa roba... no MyFilter lascialo stare... ti posto l'esempio già pronto che facciamo prima... non l'ho testato ma dovrebbe già andare... l'esempio riporta in un campo di testo il path del file gif o png che scegli...

no per gli altri esempi che mi hai mandato purtroppo non ho ancora avuto il tempo... questa roba invece l'avevo già pronta...

codice:
public void caricaFile(JTextField fileOrigine){
		JFileChooser jFileChooser = new JFileChooser();
		jFileChooser.addChoosableFileFilter(new TextFilter());
jFileChooser.addChoosableFileFilter(new JavaCodeFilter());


		File file = new File("");

		int returnVal = jFileChooser.showOpenDialog(this); 
			if (returnVal == JFileChooser.APPROVE_OPTION) {  
				try{
					
					jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
					file = jFileChooser.getSelectedFile();
					fileOrigine.setText(file.getPath());
									}catch(Exception e){
					e.printStackTrace();
				}
			} 

	}





abstract class SuffixAwareFilter 
			extends javax.swing.filechooser.FileFilter {
	  public String getSuffix(File f) {
		String s = f.getPath(), suffix = null;
		int i = s.lastIndexOf('.');

		if(i > 0 && i < s.length() - 1)
		  suffix = s.substring(i+1).toLowerCase();

		return suffix;
	  }
	  public boolean accept(File f) {
		return f.isDirectory();
	  }
	}
	
	class JavaCodeFilter extends SuffixAwareFilter {
	  public boolean accept(File f) {
		boolean accept = super.accept(f);

		if( ! accept) {
		  String suffix = getSuffix(f);

		  if(suffix != null)
			accept = super.accept(f) || suffix.equals("png");
		}
		return accept;
	  }
	  public String getDescription() {
		return "Formato Png(*.png)";
	  }
	}
	class TextFilter extends SuffixAwareFilter {
	  public boolean accept(File f) {
		String suffix = getSuffix(f);

		if(suffix != null)
		  return super.accept(f) || suffix.equals("gif");

		return false;
	  }
	  public String getDescription() {
		return "Formato Gif(*.gif)";
	  }
	}