• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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 ]
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic