Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Swing / AWT / SWT
Save contents of text area to file
mark geroso
Greenhorn
Posts: 24
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi.
I have the following code:
else if (cmd.equals("Save")){ FileDialog fdsave = new FileDialog(this, "Save this file:", FileDialog.SAVE); fdsave.setVisible(true); try{ PrintWriter fw = new PrintWriter (new FileWriter(fdsave.getDirectory() + File.separator + fdsave.getFile())); fileLoc.setText(fdsave.getDirectory() + File.separator + fdsave.getFile()); }catch(Exception ee){ System.out.println(ee.toString()); }//catch }
Opening the save dialog works and I can save the file, but the file(s) I do save contain nothing...
What am I doing wrong?
Tim LeMaster
Ranch Hand
Posts: 226
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I don't see any calls to fw to actually write anything to the file.
Michael Dunn
Ranch Hand
Posts: 4632
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
> Opening the save dialog works and I can save the file, but the file(s) I do save contain nothing...
also check that you close the writer
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Encryption/Decryption using java or oracle
help get menu items to work pleas
Control issue for File Dialog
disposing SAVE file dialog its urgent
Handling menu events
More...