Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser csv only and default directory  RSS feed

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!