• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Saving MetaData of JTextArea

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am planing to make a small application having my personal diary.
What I want is to put some text in JTextArea and when the user will click save , it should be stored as encrypted text i.e. before sending to DB ill encrypt that.

But , the question is I want rtf features in my Text i.e bold,italic etc so how to encrypt and decrypt this metadata.

Do I have to use XML for this ?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Swing/AWT
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to use Rich Text Formatting you might want to use JTextPane. It handles that sort of things and a whole lot more.

As for saving the formatting information, you do have the option of using XML. This will require that you figure out/find an XML structure to handle that.

On the other hand, JTextPane implements the serializable interface. This interface allows a class to be put in a linear format so that it can be passed into an io stream and re-instantiated into a working object.

I'm not sure exactly how that works in code, as I have never actaully done it myself, but that would probably be the easiest way to do it.

In the API doc it mentions that there will be compatibility issues from version to version and a better solution to take care of that.

Good luck.
 
tanu dua
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks John , the second option looks good.I am trying to implement this
 
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic