Yep, there is.
See: http://www.javaprogrammingforums.com/java-code-snippets-tutorials/4954-java-tipe-aug-4-2010-how-use-file-filters.html
However, I'm not sure if it will automatically add the...
Type: Posts; User: helloworld922
Yep, there is.
See: http://www.javaprogrammingforums.com/java-code-snippets-tutorials/4954-java-tipe-aug-4-2010-how-use-file-filters.html
However, I'm not sure if it will automatically add the...
Simply modify the file object you get back:
File f = c.getSelectedFile();
String filePath = f.getPath();
if(!filePath.toLowerCase().endsWith(".txt"))
{
f = new File(filePath + ".txt");
}...