This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Correctly implementing save with JFileChooser 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 "Correctly implementing save with JFileChooser" Watch "Correctly implementing save with JFileChooser" New topic
Author

Correctly implementing save with JFileChooser

Chris Waguespack
Ranch Hand

Joined: Jul 26, 2007
Posts: 36

I'm currently using JFileChooser to save a file from my application, and would like to make sure the file name the user is giving does not already exist and does not contain any OS-disallowed filename characters. So far I have


The problem with this code, is that it does not check for bad filename characters (which I can't figure out how to do) and that if the file exists already, it won't take you back to the JFileChooser to correct it (like it will in most other applications ex. Notepad).
Any ideas?

Thanks a bunch,
Chris
[ May 16, 2008: Message edited by: Chris Waguespack ]
 
 
subject: Correctly implementing save with JFileChooser
 
Similar Threads
Problems with serialization / deserialization.
In JFileDialog how to use the save window
Using JFileChooser instead of serialization hard coded files
actionPerformed in frame problem
Saving a filename in Preferences