Java Swing Tutorial - Java JFileChooser ACCEPT _ALL _FILE _ FILTER _USED _ CHANGED _PROPERTY








Syntax

JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY has the following syntax.

public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY

Example

In the following code shows how to use JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY field.

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
//from   w w w.ja va  2  s  .c  om
import javax.swing.JFileChooser;

public class Main {
  public static void main(String[] argv) throws Exception {
    final JFileChooser chooser = new JFileChooser();

    chooser.addPropertyChangeListener(new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent evt) {
        if (JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY.equals(evt.getPropertyName())) {
          JFileChooser chooser = (JFileChooser) evt.getSource();
          File oldDir = (File) evt.getOldValue();
          File newDir = (File) evt.getNewValue();

          File curDir = chooser.getCurrentDirectory();
        }
      }
    });
  }
}