Finally, i solve my own problem :-
JFileChooser FC=new JFileChooser("C:/");
FC.addChoosableFileFilter(new jpgSaveFilter());
FC.addChoosableFileFilter(new jpegSaveFilter());
FC.addChoosableFileFilter(new PngSaveFilter());
FC.addChoosableFileFilter(new gifSaveFilter());
FC.addChoosableFileFilter(new BMPSaveFilter());
FC.addChoosableFileFilter(new wbmpSaveFilter());
int retrival=m_fileChooser_save.showSaveDialog(null);
if (retrival == m_fileChooser_save.APPROVE_OPTION)
{
String EXT="";
String Extension=m_fileChooser_save.getFileFilter().getDescription();
if(Extension.equals("*.jpg,*.JPG"))
{
EXT=".jpg";
}
if(Extension.equals("*.png,*.PNG"))
{
EXT=".png";
}
if(Extension.equals("*.gif,*.GIF"))
{
EXT=".gif";
}
if(Extension.equals("*.wbmp,*.WBMP"))
{
EXT=".wbmp";
}
if(Extension.equals("*.jpeg,*.JPEG"))
{
EXT=".jpeg";
}
if(Extension.equals("*.bmp,*.BMP"))
{
EXT=".bmp";
}
Example Filter:
import java.io.*;
import java.io.File;
import java.util.*;
import javax.swing.filechooser.FileFilter;
class jpgSaveFilter extends FileFilter
{
public boolean accept(File f)
{
if (f.isDirectory())
{
return false;
}
String s = f.getName();
return s.endsWith(".jpg")||s.endsWith(".JPG");
}
public String getDescription()
{
return "*.jpg,*.JPG";
}
}