wildplace
Junior Poster in Training
63 posts since Dec 2009
Reputation Points: 10
Solved Threads: 4
Create a class that extends FilenameFilter (not FileFilter) (and it can even, easily, be an anonymous inner class) and use the setFilenameFilter method of FileDialog. Let's see your attempt at that (BTW a quick look at the API docs should have pointed this out, FileDialog only has about 10 methods). Simply have the "accept" method return true for filenames ending with "mp3" as a simple explanation. Try it, and post your attempt if you can't get it to work.
I do, however, need to ask why you wish to use the awt FileDialog rather than the Swing JFileChooser. I hope you're not mixing awt and swing elements.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
Then I can only assume your on Windows, and the API docs for setFilenameFilter says
Filename filters do not function in Sun's reference implementation for Microsoft Windows.
Switch to JFileChooser, or live with it.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494