Java save dialog swing

Show save file dialog using JFileChooser

Swing provides class javax.swing.JFileChooser that can be used to present a dialog for user to choose a location and type a file name to be saved, using showSaveDialog() method. Syntax of this method is as follows:

public int showSaveDialog( Component parent)

where parent is the parent component of the dialog, such as a JFrame . Once the user typed a file name and select OK or Cancel, the method returns one of the following value:

Оцените статью