• Post Reply Bookmark Topic Watch Topic
  • New Topic

File save and display in Swing

 
thomas jacob
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to display the contents of the file on my local drive on a TextArea or TextPane when the user selects a file using FileChooser. Later the contents of the TextArea are read and few changes are made. I want to then get the modified contexts from the TextArea/TextPane component and save it into another using Swings. How do I do that

Reg
thomas
 
Nick Meverden
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.io.FileReader
java.io.FileWriter

read up on those two API's for starters to read/write files.

You can build a StringBuilder or StringBuffer to setText() of the javax.swing.JTextArea

Those are some ideas to get you started...
 
Casper Maxwell
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For reading/writing files, the following tips may help:

Reading Text from a File
http://www.java-tips.org/java-se-tips/java.io/reading-text-from-a-file.html

Writing to a File
http://www.java-tips.org/java-se-tips/java.io/writing-to-a-file.html
[ July 21, 2006: Message edited by: Casper Maxwell ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!