The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.



Posted by Pavan Kumar Keely on July 02, 2001 at 9:57 AM

> I have an Applet program that brings a panel which contains some components. Among these component there are a button and a textArea.
> I want by clicking on the button the content of the textArea will be written on a file such that if the file exits add it at the end or over write it and otherwise create a new file and save the data.
> I tried many ways but non of them works and I thought since it is an Applet it might be defferent.
> This is one of the ways that I implemented the "actionperfom" method.

> else if ("Save".equals(actioncommand)){
> try{
> File file = new File("out.dat");
> BufferedWriter outStream = new BufferedWriter (new FileWriter(file.getName()), true);
> outStream.print(jta.getText());
> outStream.close();
> }
> catch (IOException ex) {
> jta.setText("IOERROR"+ex.getMessage()+"\n");
> }

Sign the applet, that'll work.

Pavan Kumar Keely


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us