aspose file tools*
The moose likes I/O and Streams and the fly likes Writing Documents Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Writing Documents" Watch "Writing Documents" New topic
Author

Writing Documents

Mario Bonassin
Greenhorn

Joined: Apr 08, 2004
Posts: 18
I'm trying to write a save action that will write a Document from a JTextComponent to a txt file. I can't seem to figure it out. I've looked at the API and that hasn't gotten me anywhere.
any suggestions
Mario
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Try using a FileWriter


SCJP2. Please Indent your code using UBB Code
Mario Bonassin
Greenhorn

Joined: Apr 08, 2004
Posts: 18
I've tried all those and it doesn't write a whole document.
FileWriter(document) doesn't work.
Is there something I need to do to the Document of a JTextComponent to make it saveable. Do I need to convert the entire doc to a string and then write each string or can I somehow write the doc as a whole?
this is the document i'm talking about.
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/Document.html
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8908
    
    8

The documentation for Document directs you to this article on the Element interface. That article directs you to the API documentation for EditorKit which has methods for reading and writing to/from streams.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing Documents