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 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jfilechooser saving files with file extension" Watch "Jfilechooser saving files with file extension" New topic
Author

Jfilechooser saving files with file extension

Prasath Nadarajah
Greenhorn

Joined: Sep 18, 2010
Posts: 18
Hi,
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
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

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.
 
 
subject: Jfilechooser saving files with file extension
 
Similar Threads
Getting correct filename with JFileChooser
JFileChooser
JFileChoosers and file extensions
Problems with serialization / deserialization.
JfileChooser selecting existing file.......?