Revision 17188
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/swing/JFileChooser.java | ||
---|---|---|
129 | 129 |
*/ |
130 | 130 |
public JFileChooser(String fileChooserID, String defaultDirectoryPath, FileSystemView fsv) { |
131 | 131 |
this(fileChooserID, new File(defaultDirectoryPath), fsv); |
132 |
} |
|
133 |
|
|
134 |
@Override |
|
135 |
public int showDialog(Component parent, String approveButtonText) |
|
136 |
throws HeadlessException { |
|
137 |
int response = super.showDialog(parent, approveButtonText); |
|
138 |
if (response == javax.swing.JFileChooser.APPROVE_OPTION) { |
|
139 |
File[] ff = super.getSelectedFiles(); |
|
140 |
if (ff.length>0) { |
|
141 |
String theFilePath = ff[0].getAbsolutePath(). |
|
142 |
substring(0, ff[0].getAbsolutePath().lastIndexOf(File.pathSeparator)); |
|
143 |
jfcLastPaths.put(fileChooserID, theFilePath); |
|
144 |
} else if (super.getSelectedFile() != null) { |
|
145 |
File f = super.getSelectedFile() ; |
|
146 |
String theFilePath = f.getAbsolutePath(). |
|
147 |
substring(0, f.getAbsolutePath().lastIndexOf(File.separator)); |
|
148 |
jfcLastPaths.put(fileChooserID, theFilePath); |
|
132 |
} |
|
149 | 133 |
|
150 |
} |
|
151 |
} |
|
152 |
|
|
153 |
return response; |
|
154 |
} |
|
155 |
} |
|
134 |
@Override |
|
135 |
public int showDialog(Component parent, String approveButtonText) throws HeadlessException { |
|
136 |
int response = super.showDialog(parent, approveButtonText); |
|
137 |
jfcLastPaths.put(fileChooserID, this.getCurrentDirectory().getAbsolutePath()); |
|
138 |
|
|
139 |
return response; |
|
140 |
} |
|
141 |
} |
Also available in: Unified diff