JFileChooser.showSaveDialog(Component parent) has the following syntax.
public int showSaveDialog(Component parent) throws HeadlessException
In the following code shows how to use JFileChooser.showSaveDialog(Component parent) method.
/*from w w w. j a v a 2 s. c om*/ import javax.swing.JFileChooser; public class Main { public static void main(String[] a) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.showSaveDialog(null); } }