Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package components;
- import java.io.File;
- import javax.swing.*;
- import javax.swing.filechooser.*;
- /* ImageFilter.java is used by FileChooserDemo2.java. */
- public class FileFilter extends FileFilter {
- //Accept all directories and txt files.
- public boolean accept(File f) {
- if (f.isDirectory()) {
- return true;
- }
- String extension = Utils.getExtension(f);
- if (extension != null) {
- if (extension.equals(Utils.txt)) {
- return true;
- } else {
- return false;
- }
- }
- return false;
- }
- //The description of this filter
- public String getDescription() {
- return "Just A Text File";
- }
- }
Add Comment
Please, Sign In to add comment