Here you can find the source of getFileFromChooserSave()
public static File getFileFromChooserSave()
//package com.java2s; //License from project: Open Source License import java.io.*; import javax.swing.JFileChooser; public class Main { public static File getFileFromChooserSave() { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("save as file"); chooser.setSize(new java.awt.Dimension(45, 37)); // Generated // chooser.setFileFilter(new FileNameExtensionFilter("png", "png")); File file = null;/*from www. j a v a2 s . c om*/ if (chooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); return file; } return file; } public static File getFileFromChooserSave(String folderPath) { JFileChooser chooser = new JFileChooser(folderPath); chooser.setDialogTitle("save as file"); chooser.setSize(new java.awt.Dimension(45, 37)); // Generated // chooser.setFileFilter(new FileNameExtensionFilter("png", "png")); File file = null; if (chooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); return file; } return file; } }