Java JFileChooser CONTROL _BUTTONS _ARE _SHOWN _CHANGED _PROPERTY

Syntax

JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY has the following syntax.

public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY

Example

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


/*from  w w w .j  a v a  2 s.  co  m*/
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) throws Exception {
    final JFileChooser chooser = new JFileChooser();

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

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