Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 1 month ago
Read/Write from text file to TextArea
I would like to create editable TextArea that read/write from file on filesystem. Can I use TextArea's setdata to read and write to file? Are there any example in book or tutorial;?
-Thanks
Last updated on Apr, 5th 2012
I am not sure if there is an example for this in the book. But I can not see why this should not work.
I would do something like that:
- Read the content of the file (into a StringBuffer, etc.)
- Fill the TextArea with the StringBuffer (via setValue())
- When edit is done get it from the TextArea with getValue()
- Write the content into a NEW file
- If the new file was created without any errors remove the origin file
- Set the filename of the new file to the filename of the origin filename
I am not an expert in Vaadin. But I hope this helps.
Last updated on Apr, 6th 2012
You cannot reply to this thread.