Example usage for javax.swing JFileChooser addPropertyChangeListener

List of usage examples for javax.swing JFileChooser addPropertyChangeListener

Introduction

In this page you can find the example usage for javax.swing JFileChooser addPropertyChangeListener.

Prototype

public void addPropertyChangeListener(PropertyChangeListener listener) 

Source Link

Document

Adds a PropertyChangeListener to the listener list.

Usage

From source file:Main.java

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

    chooser.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(evt.getPropertyName())) {
                JFileChooser chooser = (JFileChooser) evt.getSource();
                File oldFile = (File) evt.getOldValue();
                File newFile = (File) evt.getNewValue();

                File curFile = chooser.getSelectedFile();
            }/*from ww  w.jav  a  2s.c o  m*/
        }
    });
}

From source file:Main.java

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

    chooser.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (JFileChooser.SELECTED_FILES_CHANGED_PROPERTY.equals(evt.getPropertyName())) {
                JFileChooser chooser = (JFileChooser) evt.getSource();
                File[] oldFiles = (File[]) evt.getOldValue();
                File[] newFiles = (File[]) evt.getNewValue();

                // Get list of selected files
                File[] files = chooser.getSelectedFiles();
            }//  ww  w.  j a v a  2 s .  co  m
        }
    });
}

From source file:Main.java

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

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

                File curDir = chooser.getCurrentDirectory();
            }/* w  w w.  jav a 2  s . c om*/
        }
    });
}

From source file:Main.java

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

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

                File curDir = chooser.getCurrentDirectory();
            }//from  w w w .j  a  v  a  2  s  .c om
        }
    });
}

From source file:Main.java

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

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

                File curDir = chooser.getCurrentDirectory();
            }//from  w ww .java 2s .  c o  m
        }
    });
}

From source file:Main.java

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

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

                File curDir = chooser.getCurrentDirectory();
            }/*from  w  w  w  .j a  va2 s  .c o  m*/
        }
    });
}

From source file:Main.java

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();
            }/*from  ww  w  .  jav  a  2  s.  c  o  m*/
        }
    });
}

From source file:Main.java

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

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

                File curDir = chooser.getCurrentDirectory();
            }/*from  w  ww .j av a  2s .co  m*/
        }
    });
}

From source file:Main.java

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

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

                File curDir = chooser.getCurrentDirectory();
            }/*from   w ww. j a  v a 2  s.  com*/
        }
    });
}

From source file:Main.java

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

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

                File curDir = chooser.getCurrentDirectory();
            }/*from w  ww .  java2  s  . c om*/
        }
    });
}