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

JFileChooser showing files and directory  RSS feed

 
Gulshan Singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code is used to browse for files in my program:


Then I wanted to limit whatever comes up to directories and text files (files with a .txt extension), so I uncommented the the lines in the code that are commented above, and add this class:

This filtered all the files except for files with a .txt extension, just like I wanted, but it got rid of the directories too.. How do I change this so that it only shows file with a .txt extension and directories?
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Gulshan Singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:


Thanks, works now :)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!