2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 2 of the License, or
5
* (at your option) any later version.
6
* This program is distributed in the hope that it will be useful,
7
* but WITHOUT ANY WARRANTY; without even the implied warranty of
8
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
* GNU General Public License for more details.
10
* You should have received a copy of the GNU General Public License
11
* along with this program; if not, write to the Free Software
12
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
@author George El-Haddad
18
@email nekromancer@users.sourceforge.net
28
private File file = null;
33
Creates a file selection dialog starting at the current
34
working directory. The user will specify what directory
35
or folder they want their files to be saved in.
37
@param java.lang.String title the title of the JFileChooser
38
@param java.lang.String name a recomended name
40
@exception java.lang.Exception ex
42
public FileSave(String title, String name)
44
JFileChooser chooser = new JFileChooser();
46
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
47
chooser.setDialogTitle(title);
48
chooser.setCurrentDirectory(new File(System.getProperties().getProperty("user.dir")));
49
chooser.setFileFilter(new javax.swing.filechooser.FileFilter()
51
public boolean accept(File f)
53
return f.isDirectory();
56
public String getDescription()
58
return "Folder To Save In";
62
//show the file chooser dialog
63
int r = chooser.showSaveDialog(null);
65
if (r == JFileChooser.APPROVE_OPTION)
69
file = new File(chooser.getSelectedFile().getPath()+File.separator+name);
72
file = new File(chooser.getSelectedFile().getPath());
81
Returns the directory path as
93
String getPathString()
95
Returns the directory path as
98
@return java.lang.String
100
public String getPathString()
108
return file.getPath();
113
}//end class FileSave