@@ -74,8 +74,6 @@ public class FilePropertyEditor extends AbstractPropertyEditor {
private JTextField _widget = null;
private JTextField _widget = null;
/** Container for the editor. */
/** Container for the editor. */
private JPanel _container = null;
private JPanel _container = null;
/** Default path. */
private String _path = null;
/** File filter to use. */
/** File filter to use. */
private FileFilter _filter = null;
private FileFilter _filter = null;
@@ -87,11 +85,7 @@ public class FilePropertyEditor extends AbstractPropertyEditor {
_container = new JPanel(new BorderLayout());
_container = new JPanel(new BorderLayout());
_widget = new JTextField() {
public boolean isManagingFocus() {
return false;
}
};
_widget = new JTextField();
_widget.addFocusListener(new FocusHandler(this));
_widget.addFocusListener(new FocusHandler(this));
@@ -194,15 +188,6 @@ public class FilePropertyEditor extends AbstractPropertyEditor {
return new File(_widget.getText()).getAbsolutePath();
return new File(_widget.getText()).getAbsolutePath();
}
}
/**
* Set the default path for the file chooser
*
* @param path default path
*/
public void setDefaultPath(String path) {
_path = path;
}
/** Handler for presses of the browse button. */
/** Handler for presses of the browse button. */
private class ActionHandler implements ActionListener {
private class ActionHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
@@ -210,9 +195,6 @@ public class FilePropertyEditor extends AbstractPropertyEditor {
if(_widget.getText().length() > 0) {
if(_widget.getText().length() > 0) {
chooser = new JFileChooser(_widget.getText());
chooser = new JFileChooser(_widget.getText());
}
}
else if(_path != null) {
chooser = new JFileChooser(_path);
}
else {
else {
chooser = new JFileChooser();
chooser = new JFileChooser();
}
}
@@ -222,7 +204,11 @@ public class FilePropertyEditor extends AbstractPropertyEditor {
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
if(chooser.showDialog(getChild(), "Select") ==
if(chooser.showDialog(getChild(), "Select") ==
JFileChooser.APPROVE_OPTION) {
JFileChooser.APPROVE_OPTION) {
setValue(chooser.getSelectedFile());
Object oldValue = getValue();
Object newValue = chooser.getSelectedFile();
setValue(newValue);
firePropertyChange(oldValue, newValue);
}
}
}
}
}
}