};
fileChooser.addChoosableFileFilter(pngFilter);
fileChooser.setFileFilter(pngFilter);
int returnValue = fileChooser.showSaveDialog(dialog);
if (returnValue == JFileChooser.APPROVE_OPTION) {
File pngFile = fileChooser.getSelectedFile();
ImageIO.write(bi, "png", pngFile);
try {