This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes JFileChooser csv only and default directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JFileChooser csv only and default directory" Watch "JFileChooser csv only and default directory" New topic
Author

JFileChooser csv only and default directory

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
hi

when using the JFileChooser:
1. how can one strict the search for .csv files only
2. start the search from the desktop.

thanks
p
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
1. how can one strict the search for .csv files only

You can create a subclass of FileFilter and implement the accept method to accept only files ending in *.csv. Then add to the FileFilter using JFicleChooser.setFileFilter() method.

[ April 19, 2006: Message edited by: Garrett Rowe ]

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JFileChooser csv only and default directory
 
Similar Threads
CSV to Java
how to write coding for browse button in java swing?
JFileChooser
File browser crash course
Is there any Browse button control in Swing ??