Java Swing Tutorial - Java JFileChooser .getTypeDescription (File f)








Syntax

JFileChooser.getTypeDescription(File f) has the following syntax.

public String getTypeDescription(File f)

Example

In the following code shows how to use JFileChooser.getTypeDescription(File f) method.

/* www  .  j a v a 2  s . co m*/


import java.io.File;

import javax.swing.JFileChooser;

public class Main {
  public static void main(String[] argv) {
    JFileChooser chooser = new JFileChooser();
    File file = new File("filename.txt");
    String fileTypeName = chooser.getTypeDescription(file);
  }
}