0

I am making a Java application and I can't make it save multiple text files. The program must save a different file everytime the save button is pressed. Can it be done?
I thank you in advance

4
Contributors
3
Replies
4
Views
12 Years
Discussion Span
Last Post by freesoft_2000
0

Here is some partial code to help out a little more...

private String baseFileName = "junk";
private int i = 0;
public void save()
{
       String tempFileName = baseFileName + (i++) + ".txt";
       // Insert Stream Declaration Stuff       
       // Insert Code to Save File
       // Close Streams
}
0

Hi everyone,

Simply you can put you text in a jtextarea and use the write api for the jtextarea to save the text but if you are using a jtextpane then you can use the
object stream or rtf kit to read and write. Check out their invidual api's for details.

Try to yahoo for them as there are a lot of different of stream format of doing things.

Richard West

ps. Don't foget to answer the thread on the bottom of my signature

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.