Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FilenameFilter Interface!!!!!  RSS feed

 
Surya Prabhakar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my java program ,I have FileDialog class which opens out a dialog box to retrieve some files.Now I want to make only few files visible in that like of type *.txt,*.doc etcin that.
I had this program
FileDialog fd = new FileDialog(f);
fd.getDirectory(0;
fd.getFile();
In this how to keep getFilenameFilter method.
Please help me

------------------
I am a novice user.I hope people out there will help me.
 
Sean MacLean
author
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't done this in a while but here's the basics. You implement the FilenameFilter class to create your own filter (where you specify the files you want to be visible in the FileDialog). Like so,

Then, after you instantiate your FileDialog, you set the FilenameFilter, like so,

Something like that anyway. I hope this helps.
Sean
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!