import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import javax.swing.JFileChooser;
public class Main {
public static void main(String[] argv) {
final JFileChooser chooser = new JFileChooser();
File curDir = chooser.getCurrentDirectory();
chooser.setDialogTitle("" + curDir.getAbsolutePath());
chooser.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(evt.getPropertyName())) {
File curDir = chooser.getCurrentDirectory();
chooser.setDialogTitle("" + curDir.getAbsolutePath());
}
}
});
}
}
|