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.
精彩评论