简体   繁体   中英

Copying from and to text file using JFileChooser

I need to know how can i save text from a javax.swing.JTextArea using javax.swing.JFileChooser . I tried different things but i am not able to save the data from the JTextArea. And also copy from one text file to another using JFileChooser. Please help, I am relatively new to java.

Look at the Basic I/O lesson of the Java Tutorial with particular attention to Reading, Writing, and Creating Files .

For more specific advice, you would need to ask more specific questions, or any questions, for that matter.

JTextArea has read(...) and write(...) methods that you should be using.

A JFileChooser is just for getting the file name and has nothing to do with file I/O.

Copying data is a different story and Andrew has given you links to the tutorial on using file I/O.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM