this.operationType = operationType;
}
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(UICaption.dialog_caption_browse)) {
MyFileChooser chooser = new MyFileChooser(Parameter.path_previous_dir);
if (filters.length != 0) {
for (MyFileFilter filter : filters)
chooser.addChoosableFileFilter(filter);
chooser.setFileFilter(filters[0]);
}
if (isDirectory) chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (operationType == JFileChooser.SAVE_DIALOG) {
if (chooser.showSaveDialog(null)==JFileChooser.APPROVE_OPTION) {
if (txtField != null)
txtField.setText(chooser.getSelectedFile().getAbsolutePath());
}
} else {
if (chooser.showOpenDialog(null)==JFileChooser.APPROVE_OPTION) {
if (txtField != null)
txtField.setText(chooser.getSelectedFile().getAbsolutePath());
}
}
}
}