• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

File save and display in Swing

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic