• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Finding files

 
Martin Vietor
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

as usual I am sure you will be able to help my unsolvable problem in one line

I would likt to load some csv-file data. There are several files, I would like the user to be able to choose one. Is there a way to read which files are in a folder without knowing the names? Basically like any Windows application. Click "Open", get a list of files, choose one, it gets loaded.

Thanks, M
 
Rob Spoor
Sheriff
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out which methods java.io.File has for listing (hint, hint) the contents of a folder.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what java.awt.FileDialog and javax.swing.JFileChooser do. If you want to roll your own, then new File("dir").listFiles() would come in handy.
 
Martin Vietor
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a bunch, both are exactly the answers I was looking for
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic