So I know that the standard file filter code goes something like this:

FileNameExtensionFilter filter = new FileNameExtensionFilter("JPG & GIF Images", "jpg", "gif");

That example obviously applies for pictures, and the extensions it searches for are .JPG and .GIF. What if the user, however, has files with no extension? As in there is no ".". Is there a special keyword I can put on the extension portion of this? thank you for your help.

Recommended Answers

All 4 Replies

YOU might have to use another class like FileFilter for no extension
or override the accept() method to add your test.

YOU might have to use another class like FileFilter for no extension
or override the accept() method to add your test.

Oh I see. So I have to make a subclass of FileFilter for this to be possible?

Yes and NO, You need to override the accept() method of either FileFilter or FileNameExtensionFilter.

Have you tried
FileNameExtensionFilter("No extension", "");
?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.