• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFileChooser extension list

 
osgaldor Storm
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm creating a simple text editor in Java, I want to be able to allow the user to select the type of file to open or save in the JFileChooser, I don't know how to set the FileFilter to allow multple types. Can anyone point me in the right direction? Right now I can only get it to choose either text files ".txt" or all files. I want to be able to save as .html, .php, .rb. etc. I have googled the JFileChooser filefilter and can't seem to find an example or how to. Can you help?
 
Rob Camick
Ranch Hand
Posts: 2619
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's wrong with the example from the API?
 
osgaldor Storm
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't address my question.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean because it only tells you how to write a file chooser for .jpg and .gif files, and those weren't the extensions you wanted? Surely you could adapt it to your needs.
 
osgaldor Storm
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. Thank you. I have found the solution to my problem.
 
osgaldor Storm
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, no, I meant because it didn't show how to use completely different types. Gifs and Jpegs are image files.
 
Maneesh Godbole
Saloon Keeper
Posts: 11196
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic