diff options
Diffstat (limited to 'demos/java/gsviewer/src/com/artifex/gsviewer/PDFFileFilter.java')
-rw-r--r-- | demos/java/gsviewer/src/com/artifex/gsviewer/PDFFileFilter.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/demos/java/gsviewer/src/com/artifex/gsviewer/PDFFileFilter.java b/demos/java/gsviewer/src/com/artifex/gsviewer/PDFFileFilter.java new file mode 100644 index 000000000..e7bd7046f --- /dev/null +++ b/demos/java/gsviewer/src/com/artifex/gsviewer/PDFFileFilter.java @@ -0,0 +1,28 @@ +package com.artifex.gsviewer; + +import java.io.File; + +import javax.swing.filechooser.FileFilter; + +public class PDFFileFilter extends FileFilter { + + public static final PDFFileFilter INSTANCE = new PDFFileFilter(); + + @Override + public boolean accept(File f) { + if (f.isDirectory()) + return true; + String filename = f.getName(); + int ind = filename.lastIndexOf('.'); + if (ind == -1) + return false; + String ext = filename.substring(ind); + return ext.equalsIgnoreCase(".pdf"); + } + + @Override + public String getDescription() { + return "PDF Files"; + } + +} |