public void propertyChange(PropertyChangeEvent e) {
   String prop = e.getPropertyName();
   if (prop == JFileChooser.DIRECTORY_CHANGED_PROPERTY
       || prop == JFileChooser.FILE_VIEW_CHANGED_PROPERTY
       || prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY
       || prop == JFileChooser.FILE_HIDING_CHANGED_PROPERTY
       || prop == JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY) {
     validateFileCache();
   } else if ("UI".equals(prop)) {
     Object old = e.getOldValue();
     if (old instanceof BasicFileChooserUI) {
       BasicFileChooserUI ui = (BasicFileChooserUI) old;
       BasicDirectoryModel model = ui.getModel();
       if (model != null) {
         model.invalidateFileCache();
       }
     }
   } else if ("JFileChooserDialogIsClosingProperty".equals(prop)) {
     invalidateFileCache();
   }
 }
Пример #2
0
 protected void createModel() {
   if (model != null) {
     model.invalidateFileCache();
   }
   model = new BasicDirectoryModel(getFileChooser());
 }