001package jmri.util.swing; 002 003import java.io.File; 004import javax.swing.filechooser.FileFilter; 005 006/** 007 * Text by extension file filter. Matches files with extension {@literal .txt}. 008 * 009 * @author Dan Boudreau Copyright 2007 010 * @author Randall Wood Copyright 2017 011 */ 012public class TextFilter extends FileFilter { 013 014 @Override 015 public boolean accept(File f) { 016 return f.isDirectory() || f.getName().matches(".*\\.txt"); 017 } 018 019 @Override 020 public String getDescription() { 021 return "Text Documents (*.txt)"; 022 } 023 024}