This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

file format

 
raaga sree
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i select a particular file extension,the files of that format has to be listed .is thare any algorithm for that..
 
Campbell Ritchie
Sheriff
Pie
Posts: 49729
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch

There are ways of doing it with JFileChooser; you can add a filter. There is a section in the Java Tutorials about that.
There are methods in the File class; you can use the isDirectory method to find whether an object represents a directory, then the list method, then on each of the Strings the lastIndexOf or endsWith methods.

Other people will doubtless think of other ways to do it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic