This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff 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 OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP 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: 4684
    
    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