wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Jfilechooser saving files with file extension Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jfilechooser saving files with file extension" Watch "Jfilechooser saving files with file extension" New topic

Jfilechooser saving files with file extension

Prasath Nadarajah

Joined: Sep 18, 2010
Posts: 18
i want to save XML files using Jfilechooser.
i want my jfilechooser to save all files with .xml extension only (not even .text extension)
and also to open only ".xml" files
how can i do that?

How can i modify the following code??

Darryl Burke

Joined: May 03, 2008
Posts: 4523

Read the API for JFileChooser and follow the link to the tutorial on "How to Use File Choosers" where you will find a section on "Filtering the list of files"

Also, take a look at javax.swing.filechooser.FileNameExtensionFilter.

luck, db
There are no new questions, but there may be new answers.
I agree. Here's the link: http://aspose.com/file-tools
subject: Jfilechooser saving files with file extension
Similar Threads
Problems with serialization / deserialization.
Getting correct filename with JFileChooser
JfileChooser selecting existing file.......?
JFileChoosers and file extensions